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.
1
Expert's answer
2011-02-18T06:14:11-0500
#include <iostream> #include <cmath>
using namespace std;
double calculateArea(double);
int main(int argc, char** argv) { double radius; do { 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; else cout << area << endl << "The circle is small." << endl; return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment