Answer to Question #1598 in C++ for idaira

Question #1598
Write a C++ program that takes in the radius (as in integer) of a circle from user and calculate the area of the circle through a function. If the area is greater than 50, display the circle’s area along with a message that the circle is big else display the circle’s area and the message that the circle is small. Define a function named calculateArea() to take in the radius as its argument and calculate the circle’s area before returning the area as type double.
Expert's answer
#include <iostream>
#include <cmath>

using namespace std;

double calculateArea(double);

int main(int argc, char** argv)
double radius;
cout << "Input the value of radius: ";
cin >> radius;
while(radius <= 0);
double area = calculateArea(radius);
if(area > 50)
cout << area << endl << "The circle is big." << endl;
cout << area << endl << "The circle is small." << endl;
return 0;

double calculateArea(double radius)
return M_PI * pow(radius, 2) / 2.0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog