+ 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; }

9th Dec 2019, 11:57 AM
S.sh
S.sh - avatar
9 odpowiedzi
+ 2
Thank you all🙏.it work now!
9th Dec 2019, 2:31 PM
S.sh
S.sh - avatar
+ 1
Look it now!?
9th Dec 2019, 2:23 PM
S.sh
S.sh - avatar
+ 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ˋ.
9th Dec 2019, 2:27 PM
Greif
- 2
Hi
11th Dec 2019, 10:46 AM
Piyush Thakur