In procedural programming, create a function named "getArea()" with the following parameters.
a. int length
b. int width
c. int radius
Note. Use the following variable names
#include <iostream>
#include <cmath>
using namespace std;
void getArea (int length, int width, int radius) {
int recta;
float cira;
recta = length * width;
cira = 3.1416 * pow(radius, 2);
cout << "Area of Rectangle: " << recta << endl;
cout << "Area of Circle: " << cira << endl;
}
int main () {
int rectlength, rectwidth, cirradius;
cout << "Legth of rectangle: ";
cin >> rectlength;
cout << "Width of Rectangle: ";
cin >> rectwidth;
cout << "Radius of Circle: ";
cin >> cirradius;
getArea(rectlength, rectwidth, cirradius);
return 0;
}
Comments
Leave a comment