Few compiling errors that I can't fix.

Hi,
I have a few compiling errors that I can't fix in a program that's pretty much finished. I didn't know whether or not to post it here or in the beginner's forum but here it is:
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
/*  
   
*/

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

double SaleRecord(unsigned&, double&, unsigned&, double&, char&);
float calculateItemCost(char discountType, double itemPrice, double totalPrice, int quantity);
void calcTotalPrice(double totalPrice, unsigned Num, bool aborted);



int main()
{
unsigned itemID, quantity, records, totalQuantity;
char discountType;
double itemPrice, discount, transactionNumber, allPrices;

int totalRec;

SaleRecord(itemID&, itemPrice, discountType&, quantity, &transactionNumber); 
calculateItemCost(itemPrice, totalPrice, discountType, quantity); 
displayTotalPrice(totalPrice);


system("pause");
return 0;
}

void finalPrice(double finalPrice)
{
cout << "The final price with all of the items is " <<totalPrice;
return;
}


double calcItemPrice(double itemPrice, double totalPrice, char discountType, int quantity){
float discount;
switch (discountType){

case 'N': discount=1;
break;

case 'n': discount=1;
break;

case 'B': discount=0.9;
break;

case 'b': discount=0.9;
break;

case 'D': discount=0.8;
break;

case 'd': discount = 0.8;
break;

case 'T': discount=0.7;
break;

case 't': discount=0.7;
break;

default: discount=1;
}
totalPrice=itemPrice*discount*quantity;

return totalPrice;
}

double SaleRecord(unsigned & quantity, float & itemPrice, unsigned & itemID, double & transactionNumber, char & discountType)
{
int anotherTransaction = 0;
cout << "Enter the 6 digit item ID starting with a number greater than 1:";
cin >> itemID;
if (itemID <=99999 || itemID >999999)
{
cout << "You didn't enter a 6 digit item ID startin with a number greater than 1. Try again.";
system("pause");
exit(0);
}

cout << "Enter the price of the item:";
cin >> itemPrice;

if (itemPrice<0)
{
cout << "You didn't enter a valid price. Try again.";
system("pause");
exit(0);
}

cout << "Enter the discount type. The valid discount types are:\n\
\aN: No discount\n\
\aB: Basic discount (10%)\n\
\aD: Double discount (20%)\n\
\aT: Triple discount (30%)";
cin >> discountType;

if (discountType!='N' && discountType!='B' && discountType!='D' && discountType!='T')
{
cout << "You didn't enter a valid discount type. Try again.";
system("pause");
exit(0);
}

cout << "Enter the quanity of item sold.";
cin >> quantity;
if (quantity<0)
{
cout << "You didn't enter a valid quantity sold. Try again.";
system("pause");
exit(0);
}
string multipleSales;
cout << "Would you like to perform another transaction? 'yes' or 'no'";
cin >> multipleSales;
transactionNumber++;


while( multipleSales == yes)
{
cout << "Enter the 6 digit item ID starting with a number greater than 1:";
cin >> itemID;

if (itemID <=99999 || itemID >999999)
{
cout << "You didn't enter a 6 digit item ID startin with a number greater than 1. Try again.";
system("pause");
exit(0);
}

cout << "Enter the price of the item:";
cin >> itemPrice;

if (itemPrice<0.1f || itemPrice > 9999999)
{
cout << "You didn't enter a valid price. Try again.";
system("pause");
exit(0);
}

cout << "Enter the discount type. The valid discount types are:\n\
\aN: No discount\n\
\aB: Basic discount (10%)\n\
\aD: Double discount (20%)\n\
\aT: Triple discount (30%)";
cin >> discountType;

if (discountType!='N' && discountType!='B' && discountType!='D' && discountType!='T')
{
cout << "You didn't enter a valid discount type. Try again.";
system("pause");
exit(0);
}

cout << "Enter the quanity of item sold.";
cin >> quantity;

if (quantity<0)
{
cout << "Invalid Entry. Please enter the correct Quantity";
system("pause");
exit(0);
}

cout << "Would you like to perform another transaction? 'yes' or 'no'";
cin >> anotherTransaction;
transactionNumber++;
}

return (itemID, quantity, discountType, itemPrice, transactionNumber);

}


Errors are:
13 expected `,' or `...' before '&' token
In function `int main()':
25 expected primary-expression before ',' token
25 expected primary-expression before ',' token
26 `totalPrice' undeclared (first use this function) < it's declared?
(Each undeclared identifier is reported only once for each function it appears in.)
27 `displayTotalPrice' undeclared (first use this function) < also declared
In function `void finalPrice(double)':

36 In function `double SaleRecord(unsigned int&, float&, unsigned int&, double&, char&)': `totalPrice' undeclared (first use this function)
126 `yes' undeclared (first use this function)

Thanks!
Last edited on
It might help if you posted the errors verbatim.
Updated with errors.
closed account (o3hC5Di1)
See my reply to your post in the beginners forum:
http://cplusplus.com/forum/beginner/72255/#msg385440

-N
Topic archived. No new replies allowed.