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
|
#include<iostream>
#include<iomanip>
using namespace std;
// Function prototypes:
void getLength(double & Length);
void getWidth (double & Width);
double getArea(double Length, double Width);
void displayArea(double Area, double Length, double width);
int main (void)
{
{
double Length, Width, Area;
getLength(Length);
getWidth(Width);
Area = getArea(Length, Width);
displayArea(Area, Length, Width);
return 0;
}
/*
Task: To ask the user for the length and width of a rectangle and
to return these values via the two parameters.
*/
void getLength(double & Length)
{
cout << "Enter the rectangle's length: "; //Length The length entered by the user.
cin >> Length;
}
void getWidth (double & Width)
{
cout << "Enter the rectangle's width: "; //Width The width entered by the user.
cin >> Width;
}
double ComputeArea(double Length, double Width) //calculate area
{
return Length * Width;
}
void displayArea(Area, Width, Length) //should have double before Area, Width, Length, I think but am working on the braces first
{
cout << "You entered the length: " << Length << "and the width: "<< Width;
cout << "and the area of the rectangle is: " << Area << endl;
}
}//C2059 syntax error: '}' times 2, and missing ; before '}', all on line 46
|