Answer to Question #3311 in C++ for mukunda
Write a program to calculate the area of square, rectangle & circle.
1
2011-07-06T05:39:29-0400
#include <iostream>
using namespace std;
double area_square (double width) { return width * width; }
double area_rectangle (double width, double height) { return width * height; }
double area_circle (double radius) { return 3.141593 * radius * radius; }
int main()
{
double width = 10, height = 15, radius = 8;
cout << "Area of square is " << area_square (width) << endl;
cout << "Area of rectangle is " << area_rectangle (width, height) << endl;
cout << "Area of circle is " << area_circle (radius) << endl;
return 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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment