Function does not take arguments

Hey guys this is a very ruff work on a program that I am doing for my class. Generally I have to make a program to compute four different things. I also need to create a menu, have a customer service representative take down the points and pass it to an engineer to do the calculations.. this is all using functions with C++

I have pretty much finished the functions (might not be perfect), but I am just having a few issues with calling functions in my main program.. any help would be greatly appreciated.

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#include <iostream>
#include <math.h>
using namespace std;

int DisplayMenu();
double computeDistance(double pointxI, double pointxII, double pointyI, double pointyII);
double computeHorizontalangle(double pointxI, double pointxII, double pointyI, double pointyII);
double HorizontalDistance(double elevationAngleD, double velocityMiles);
double computeDestination(double pointxI, double pointyI, double pointDistance, double horizontalAngleD, double  &destinationX, double &destinationY);
void customerService(int programChoice, double &pointxI, double &pointxII, double &pointyI, double &pointyII, double &elevationAngleD, double &velocityMiles, double &pointDistance, double &horizontalAngleD);
double engineer(int programChoice, double pointxI, double pointxII, double pointyI, double pointyII, double elevationAngleD, double velocityMiles, double pointDistance, double horizontalAngleD);
void displayResults(int programChoice, double pointDistance, double degreeAngle, double horizontalDistanceF, double destinationX, double destinationY);


void main(void)
{
	double pointxI, pointxII, pointyI, pointyII, elevationAngleD, velocityMiles, pointDistance, horizontalAngleD;

	cout << endl << "Compute Different Awesome Equations" << endl << endl;

	DisplayMenu();

	customerService(pointxI, pointxII, pointyI, pointyII, elevationAngleD, velocityMiles, pointDistance, horizontalAngleD);

	
}

double computeDistance(double pointxI, double pointxII, double pointyI, double pointyII)
{
	double pointDistance;

	pointDistance = sqrt(pow(pointxII - pointxI, 2) + pow(pointyII - pointyI, 2));

	return pointDistance;
}

double computeHorizontalangle(double pointxI, double pointxII, double pointyI, double pointyII)
{
	const double PI = 3.14159;
	double distanceX, distanceY, radianAngle, degreeAngle;

	distanceX = pointxII - pointxI;
	distanceY = pointyII - pointyI;

	if (distanceX > 0)
	{
		radianAngle = atan(distanceY / distanceX);
	}
	else if (distanceX < 0)
	{
		radianAngle = atan(distanceY / distanceX) + PI;
	}
	else if (distanceX = 0 && distanceY >= 0)
	{
		radianAngle = PI/2;
	}
	else 
	{
		radianAngle = -PI/2;
	}

	degreeAngle = radianAngle * (180/PI);

	return degreeAngle;
}

double HorizontalDistance(double elevationAngleD, double velocityMiles)
{
	const double gravity = 32.172, FeetperMile = 5280, SecsperHour = 3600, PI = 3.141519;
	double elevationAngleR, velocityFeet, horizontalDistanceF;

	elevationAngleR = elevationAngleD * (PI / 180);

	velocityFeet = velocityMiles * (FeetperMile / SecsperHour);

	horizontalDistanceF = pow(velocityFeet, 2) * sin(2 * elevationAngleR) / gravity;

	return horizontalDistanceF;
}

double computeDestination(double pointxI, double pointyI, double pointDistance, double horizontalAngleD, double  &destinationX, double &destinationY)
{
	const double PI = 3.14159;
	double horizontalAngleR, distanceX, distanceY;

	horizontalAngleR = horizontalAngleD * (PI / 180);

	distanceX = pointDistance * cos(horizontalAngleR);

	distanceY = pointDistance * sin(horizontalAngleR);

	destinationX = pointxI + distanceX;

	destinationY = pointyI + distanceY;

	return 0;
}

int DisplayMenu()
{
	int programChoice;

	do 
	{

	cout << endl;
	cout << "Choose from the following options: " << endl;
	cout << "(1) Compute the distance between two points" << endl;
	cout << "(2) Compute the horizontal angle of two points" << endl;
	cout << "(3) Compute the (horizontal) distance (in feet)" <<
		" that an object travels" << endl;
	cout << "(4) Compute destination point" << endl;
	cout << "(5) Exit the program" << endl;

	cout << "Please enter your selection: ";
	cin >> programChoice;

		if (programChoice > 5 || programChoice < 0)
		{
			cout << endl << "Please enter a number from 1 to 5";
			cout << endl << endl;
		}
	}
	while (programChoice > 5 || programChoice < 0);

	return programChoice;
}

double engineer(int programChoice, double pointxI, double pointxII, double pointyI, double pointyII, double elevationAngleD, double velocityMiles, double pointDistance, double horizontalAngleD, double  destinationX, double destinationY)
{
	if (programChoice == 1)
	{
		computeDistance(pointxI, pointxII, pointyI, pointyII);
	}
	else if (programChoice == 2)
	{
		computeHorizontalangle(pointxI, pointxII, pointyI, pointyII);
	}
	else if (programChoice == 3)
	{
		HorizontalDistance(elevationAngleD, velocityMiles);
	}
	else if (programChoice == 4)
	{
		computeDestination(pointxI, pointyI, pointDistance, horizontalAngleD, destinationX, destinationY);
	}

	return 0;
}

double customerSevice(int programChoice, double &pointxI, double &pointxII, double &pointyI, double &pointyII, double &elevationAngleD, double &velocityMiles, double &pointDistance, double &horizontalAngleD)
{
	if (programChoice == 1 || programChoice == 2)
	{
		cout << endl << "Please enter your first x point: ";
		cin >> pointxI;
		
		cout << endl << "Please enter your second x point: ";
		cin >> pointxII;

		cout << endl << "Please enter your first y point: ";
		cin >> pointyI;

		cout << endl << "Please enter your second y point: ";
		cin >> pointyII;

		cout << endl << "Thank you!" << endl;
	}
	else if (programChoice == 3)
	{
		do
		{
			cout << endl << "Please enter the elevation angle: ";
			cin >> elevationAngleD;

			if (elevationAngleD < 0 || elevationAngleD > 90)
			{
				cout << endl << "Please inpute an angle between 0 - 90 degrees";
				cout << endl << endl;
			}
		}
		while (elevationAngleD < 0 || elevationAngleD > 90);

		do
		{
			cout << endl << "Please enter the velocity: ";
			cin >> velocityMiles;

			if (velocityMiles < 0)
			{
				cout << endl << "Please enter a positive velocity";
				cout << endl << endl;
			}
		}
		while (velocityMiles < 0);

		cout << endl << "Thank You!" << endl;
	}
	else if (programChoice == 4)
	{
		cout << endl << "Please enter your x point: ";
		cin >> pointxI;

		cout << endl << "Please enter your y point: ";
		cin >> pointyI;

		do 
		{
			cout << endl << "Please enter your distance: ";
			cin >> pointDistance;

			if (pointDistance < 0)
			{
				cout << endl << "Please enter a positive distance";
				cout << endl << endl;
			}
		}
		while (pointDistance < 0);

		do 
		{
			cout << endl << "Please enter your horizontal angle: ";
			cin >> horizontalAngleD;

			if (horizontalAngleD < 0 || horizontalAngleD > 360)
			{
				cout << endl << "Please enter an angle between 0 - 360 degrees";
				cout << endl << endl;
			}
		}
		while (horizontalAngleD < 0 || horizontalAngleD > 360);
	}

	return 0;
}

void displayResults(int programChoice, double pointDistance, double degreeAngle, double horizontalDistanceF, double destinationX, double destinationY)
{
	if (programChoice == 1)
	{
		cout << "The distance between your two points is: " << pointDistance << endl;
	}
	else if (programChoice == 2)
	{
		cout << "The horizontal angle from the first point to the second point is: " << degreeAngle << endl;
	}
	else if (programChoice == 3)
	{
		cout << "The horizontal distance (in feet) the object traveled is: " << horizontalDistanceF << endl;
	}
	else if (programChoice == 4)
	{
		cout << "The destination point is: (" << destinationX << "," << destinationY << ")" << endl;
	}
}


like I said this is a very ruff draft of the main program we are going to be writing..

but the error I have been getting is

error C2660: 'customerService' : function does not take 8 arguments

I know it has to be something I am doing wrong in terms of calling the function with the parameters.. but I can't figure it out.. and I stopped with the customerService function because I know if I am having issues with this one I am sure I will have issues calling the other ones.

Thanks in advance guys!!
What you want to do is pass the choice the user made in DisplayMenu() to customerService(). What you do now is discard that choice and call customerService() leaving out the first parameter: the choice.

This is a possible (and the shortest) solution:
 
customerService( DisplayMenu(), pointxI, pointxII, pointyI, pointyII, elevationAngleD, velocityMiles, pointDistance, horizontalAngleD);


See? The return value of DisplayMenu() is passed to customerService as parameter.

By the way: always declare your main function as int main and add return 0; at the end.
Last edited on
Topic archived. No new replies allowed.