My program closes when I press enter . . .
I am a noob, so bare with me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <string>
#define pi 3.14
using namespace std;
int main ()
{
double C;
int diameter;
cout << "Enter the diameter \n";
cin >> diameter;
C = diameter * pi;
cout << "The circumference is " << C;
return 0;
}
|
When I run the program, I see the first line, which says "Enter the diameter" After entering a number, and pushing enter, the program closes . . .
What's wrong here?
See: Console Closing Down
http://www.cplusplus.com/forum/beginner/1988/
Topic archived. No new replies allowed.