anonymous
2012-03-23 10:25:02 UTC
The syntax error is that at the last function it declares the double length as a shadow parameter and same for width and area.
#include
using namespace std;
double getLength();
double getWidth();
double getArea();
double displayData(double, double, double);
int main()
{
double length, // The rectangle's length
width, // The rectangle's width
area; // The rectangle's area
// Get the rectangle's length.
length = getLength();
// Get the rectangle's width.
width = getWidth();
// Get the rectangle's area.
area = getArea();
// Display the rectangle's data.
displayData(length, width, area);
system("pause");
return 0;
}
//*****************************************************************************
// Purpose: Prompt and display the length of the rectangle
// Date: March 23, 2012
//*****************************************************************************
double getLength(double)
{
//declare variables
double length;
//prompt the user
cout << "Enter the length of the rectangle: ";
cin >> length;
//return value
return length;
}
//****************************************************************************
// Purpose: Prompt and display the width of the rectangle
// Date: March 23, 2012
//****************************************************************************
double getWidth(double)
{
//declare variables
double width;
//prompt the user
cout << "Enter the width of the rectangle: ";
cin >> width;
//return value
return width;
}
//*****************************************************************************
// Purpose: Calculate the area of the rectangle
// Date: March 23, 2012
//*****************************************************************************
double getArea(double)
{
//declare variables
double area,
length,
width;
//calculate the area
area = length * width;
//return value
return area;
}
//*****************************************************************************
// Purpose: Display the data
// Date: March 23, 2012
//*****************************************************************************
double displayData(double length, double width, double area)
{
//declare variables
double length,
width,
area;
//display the area
cout << "The length is " << length
<< "The width is " << width
<< "The area is " << area
<< endl;
//return value
return length, width, area;
}