1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include <iostream>
using namespace std;
double getLength();
double getWidth();
double getArea(double length, double width, double area);
double getPerimeter(double length, double width);
void displayData(double length, double width, double perimeter, double area);
int main()
{
double length;
double width;
double perimeter;
double area;
length = getLength();
width = getWidth();
area = getArea(length, width, area);
perimeter = getPerimeter(length, width);
displayData(length, width, perimeter, area);
system("pause");
return 0;
}
double getLength();
{
double length;
cout << "Please enter the length of the rectangle: " << endl;
cin >> length;
return length;
}
double width();
{
double width;
cout << "Please enter the width of the rectangle: " << endl;
cin >> width;
return width;
}
double getArea(length, width);
{
double area;
area = length * width;
return area
}
double getPerimeter();
{
double perimeter;
perimeter = 2 * (length * width);
return perimeter
}
void DisplayData(length, width, perimeter, area)
{
cout << "The length of the rectangle is: " << length << endl << endl;
cout << "The width of the rectangle is: " << width << endl << endl;
cout << "The perimeter of the rectangle is: " << perimeter << endl << endl;
cout << "The area of the rectangle is: " << area << endl << endl;
}
|