+ 1
Why my program it doesn't work?
#include <iostream> #define PI 3.14 using namespace std; int main() { int radius; float area,perime; cout<<"enter the radius of circle"<<endl; cin>>"radius"; area=PI * radius; perime=2. * PI * radius ; cout<<"area ="<<area<<" , perime ="<<perime; return 0; }
9 Answers
+ 2
Thank you allđ.it work now!
+ 1
Look it now!?
+ 1
If you mean your program ËËcalculate radiusËË, then you should look on your ËËcinËË statement. If you want to read something from an input stream, you write that into a variable and not into a string. So you should remove the quotes around the variable name like this:
// change Ëcin >> âradiusâ;Ë to
...
cin >> radius;
...
I also think the formular for calculating the area of a circle is ËPI * radius^2 = PI * radius * radiusË, not just ËPI * radiusË.
- 2
Hi