Quote:
Originally posted by kokkines
Thanks. How would I go about doing that?
|
Remove the
Planet A[5]; from the
void Planet::find() Since you're declaring A as Planet class within the main you shouldn't need to declare it within it's own find function.
On a closer look, it seems your Planet class definition won't work with this sort of find() function.
Code:
class Planet
{
private:
string name;
float radius;
float median;
public:
/* create functions to deal with any type of "decleration" */
bool Planet();
bool Planet(string name);
bool Planet(string name, float radius);
bool Planet(string name, float radius, float median);
/* delete function */
bool ~Planet();
float sa();
float den();
void output();
void outputaf();
};
bool Planet::Planet()
{
return (this.name = "" &&
this.radius = 0.0 &&
this.median = 0.0);
}
bool Planet::Planet(string name)
{
return (this.name = name &&
this.radius = 0.0 &&
this.median = 0.0);
}
bool Planet::Planet(string name, float radius)
{
return (this.name = name &&
this.radius = radius &&
this.median = 0.0);
}
bool Planet::Planet(string name, float radius, float median)
{
return (this.name = name &&
this.radius = radius &&
this.median = median);
}
bool Planet::~Planet()
{
return (this.name = "" &&
this.radius = 0.0 &&
this.median = 0.0);
}
float Planet::sa()
{
return pow(this.radius,2)*4*M_PI;
}
float Planet::den()
{
return (this.median/(pow(this.radius,3)*M_PI*4/3));
}
class Planets
{
private:
vector<Planet> P
public:
bool sort();
bool add();
bool del();
void find();
}
might be a better aproach.