Create a program that will compute:
#include <iostream>
#include <cmath>
using namespace std;
void circle (int radius) {
const float pi = 3.14159;
cout << "The area of the circle: " << pi * pow(radius, 2) << endl;
cout << "The circumference of the circle: " << 2 * pi * radius << endl;
}
void rectangle (int length, int width) {
cout << "The area of the rectangle: " << width * length << endl;
cout << "The perimetr of the rectangle: " << 2 * (width + length) << endl;
}
int main () {
int w, l;
float r;
cout << "Enter radius of the circle: "; cin >> r;
circle(r);
cout << "Enter length of rectangle: "; cin >> l;
cout << "Enter width of rectangle: "; cin >> w;
rectangle(l, w);
return 0;
}
Comments
Leave a comment