+ 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 odpowiedzi
+ 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