0

Hi, new learner to C++. I have to write 4 functions to compute and return the diameter, circumference, etc. of a circle. I think I might be on the right track but I'm probably making this harder than it has to be. I commented most code out because I'd like to get one thing working and then go back and finish. How do I get the radius value into the equation? When I run it the answer comes up

-1.#IND when I put in a radius of 2.

```
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std ;
double radius ;
double diam ;
double const PI = 3.14159265358979323846 ;
double diameter(double diam)
{
double d ;
while (d = 2 * radius )
return d ;
}
//double circum(double circumf)
//{
// return diam * PI ;
//}
//
//double area(double area1)
//{
// return PI * pow(radius, radius) ;
//}
//
//double volume(double vol1)
//{
// return (4.0/3.0) * (radius * radius * radius) * PI ;
//}
int main()
{
double radius ;
cout << "Please enter the radius of a circle: " ;
cin >> radius ;
double d = diameter(diam) ;
cout << "The diameter of the circle is: " << d << endl ;
/*circum(circumf);
cout << "The circumference of the circle is: " << circumf << endl;
area(area1);
cout << "The area of the circle is: " << area1 << endl;
volume(vol1);
cout << "The volume of the sphere is: " << vol1 << endl;*/
return 0 ;
}
```

Thank you!