I'm trying to write a program that prompts a user for a radius value, then uses class data to return info of a sphere based on that radius.

I believe my problem lies in declaring what information goes into what class member, but I'm not entirely sure. How do I make this work?

Also, when using cin.get(), the user has to hit enter to exit the program. Is there a way that they literally hit 'any key' for them to exit (besides of course system("Pause");?

```
#include <iostream>
#include <iomanip>
#include <math.h>
float pi=3.14159;
using namespace std;
class Sphere
{
private:
float radius;
float Vol;
float SA;
public:
/*Radius(double = .5);
Radius(const Radius&);
~Radius();
void SetRadius(double aRadius); */
float GetRadius(void);
void ShowData(void);
float ConvRadToVol(float arad);
float ConvRadToSA(float arad);
};
int main (void)
{
//Object Initialization
Sphere Sweet;
cout << "This program takes a given radius value and computes the data of a sphere with that radius" << endl;
Sweet.GetRadius();
cout << "A sphere with that radius would have the following properties:\n" << endl;
Sweet.ShowData();
system("Pause");
return 0;
}
//Defining radius
float Sphere::GetRadius(void)
{
cout << "What is the radius?" << endl;
cin >> radius >>endl;
return radius;
}
//Calculating Vol
float Sphere::ConvRadToVol(float radius)
{
if (radius<0)
{
std:cerr << "Radius can't be negative\n";
}
else
{
Vol = (4/3)*pi*pow(radius,3) ;
return Vol;
}
}
//Calculating Surface Area
float Sphere::ConvRadToSA(float radius)
{
if (radius<0)
{
std:cerr << "Radius can't be negative\n";
}
else
{
SA = 4*pi*pow(radius,2) ;
return SA;
}
}
//Displaying the sphere data
void Sphere::ShowData(void)
{
cout << "Volume: " << Vol << endl;
cout << "Surface Area: " << SA << endl;
}
```