Functions question

Hey all! I am working on my 4th C++ program and am running into a problem. I am getting error LNK2019 and LNK1120 in Visual Studio. I am trying to get my program to use 4 functions, one to get the length of a rectangle, one to get width, one to accept the width and length and calculate the area, and one to accept all three paramaters and display them.

Anyone see what I am doing wrong here? Says I have unresolved external statements. Thanks in advance for any help!

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>
using namespace std;

void getLength(float& length);									//function prototype
void getWidth(float& width);									//function prototype
void getArea(float& length, float& width);						//function prototype
void displayData(float& length, float& width, float& area);		//function prototype

int main()
{
	//variables
	float length;	//user input for length
	float width;	//user input for width
	float area;		//value after calculation

	//Get the information from the user
	getLength(length);
	getWidth(width);
	getArea(width, length);
	displayData(width, length, area);
	
}

void getLength(float& length)
{
	//Get the length from the user
	cout << "Please enter the length of the rectangle: " << endl;
	cin >> length;
}

void getWidth(float& width)
{
	//Get the width from the user
	cout << "Please enter the width of the rectangle: " << endl;
	cin >> width;
}

void getArea(float& length, float& width, float& area)
{
	area = length * width;
}

void displayData(float& area, float& length, float& width)
{
	//Display the area
	cout << "The area of a rectangle with a length of " << length << " and a width of " << width << " is: " << area << "." << endl << endl;
	cout << "Thank you for using this program!" << endl << endl;
}
closed account (E3h7X9L8)
in getArea function prototype and declaration of getArea in the main is missing area
Oh goodness! Thank you so much. Overlook on my part.
Topic archived. No new replies allowed.