Radius of a circle

After I put in the radius when I run it, the area and perimeter don't show up.
Could someone give me an idea?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <iostream>
using namespace std;


int main()
{
	const double pi = 3.14;
	double radius, area, circumference;

	cout << "please input radius : ";
	cin >> radius;
	cout << endl;

	circumference = 2 * pi * radius;
	area = pi * radius * radius;


	cout << "area :  " << area << endl;

	cout << "circumference : " << circumference << endl;

	cin.get(); // keep the console open till user presses ente


	return 0;
}
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
using namespace std;


int main()
{
	const double pi = 3.14;
	double radius, area, circumference;

	cout << "please input radius : ";
	cin >> radius;
	cout << endl;

	circumference = 2 * pi * radius;
	area = pi * radius * radius;


	cout << "area :  " << area << endl;

	cout << "circumference : " << circumference << endl;
       
        cin.ignore( 1000, '\n' ) ; // extract and discard the new line charecter remaining in the input buffer
	cin.get(); // keep the console open till user presses enter


	// return 0; // this is not required; there is an implicit return 0 at the end of main
}
thanks
Topic archived. No new replies allowed.