I thought I was following a recipe that worked, but not so. Can someone explain to me why this does not compile? (And I have yet to include a couple of constructors!) - Thanks, Rich.
//CIS 180 Rich Mansfield 0457321 12/6/09
//Lab11.1 - This program illustrates the use of classes
#include <iostream>
using namespace std;
class Circle
{
private:
double radius;
const double PI = 3.1416;
public:
void setRadius(double);
double getRadius() const;
double getDiameter() const;
double getCircumference() const;
double getArea() const;
};
void Circle::setRadius(double r)
{
radius = r;
}
double Circle::getRadius() const
{
return radius;
}
double Circle::getDiameter() const
{
return 2 * radius;
}
double Circle::getCircumference() const
{
return 2 * PI * radius;
}
double Circle::getArea() const
{
return PI * radius * radius;
}
int main()
{
Circle C1;
double radiusLength;
cout << “Input the radius:” ;
cin >> radiusLength;
C1.setRadius(radiusLength);
cout << "Here is the circle C1’s data:\n";
cout << "Radius: " << C1.getRadius() << endl;
cout << "Diameter: " << C1.getDiameter() << endl;
cout << "Circumference: " << C1.getCircumference() << endl;
cout << "Area: " << C1.getArea() << endl;
return 0;
}
/* These error msgs I'm getting make no sense to me:
----jGRASP exec: c++ -g /Users/richmansfield/lab11.2
ld warning: in /Users/richmansfield/lab11.2, file is not of required architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
----jGRASP wedge: exit code for process is 1.
----jGRASP: operation complete. */