Correct my Program

Help me fix the syntax errors!

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
 #include <iostream>
using namespace std;
int main()

double area, length= 0.0, width= 0.0, area= 0.0;    

{           
    getInput(length, width);
    area = getArea(length, width);
    displayData(length, width, area);
          
   return 0;
}

void getInput (double length, double width)
{
	cout << "Please enter the length and the width of the rectangle. " << endl;
}

double getArea (double length, double width)
{
	area = length * width;
	return area;
}

void displayData (double area)
{
	cout << "The length of the rectangle is " << length << endl;
	cout << "The width of the rectangle is " << width << endl;
	cout << "The area of the rectangle is " << getArea() << endl;

}
your braces are messed up for starters. e.g.
1
2
3
4
5
int main()

double area, length= 0.0, width= 0.0, area= 0.0;    

{  


displayData takes one parameter but you're trying to push 3 in.

this:
 
area = length * width;

you don't have a local variable defined for area.

Just listen to your compiler.
Thank you, now I can pass this class.
Topic archived. No new replies allowed.