my program, new to C++, give me ur thoughts please :)

its nothing great, ive just started programing in C++ this year. I do have a back round of java so it did help a little... anyways heres my program. its not very tidy i apologize but at a 4am in morning i really couldnt be bothered nw... anyways please advise me where i could improve and what not...
thanks :)

Description of program:
*Scenario:
The Java Coffee Shop at your school needs your expertise. They want a application that will help them enter sales for their waiters. They need a program that will record the necessary information. This information include the order per table number and the total for a specific waiter. The waiter’s waige must be calculated as well at 15% of total orders for the night.

*Specification:
• There are four waiters.
• The waiter’s number must include the first character of the waiter’s
name and a random number between 1 and 50 ie. J36.
• The program should have a menu. (example)
1. Enter new orders
2. View total orders (waiter number and total order)
3. View total wage (waiter number and total wage)

my program ( i left out the table numbers on purpose, gonna attempt that at a later stage)

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
#include <string> 
#include <iostream> 
#include <ctime> 
#include <cctype> 
#include <sstream> 
#include <iomanip>
#include <fstream>

using namespace std ; 


/* VARIABLES */
int count ;

/*Other(s)*/

ofstream File ("Input.txt") ; 

/* variables for to form waiters_code*/
char name ; 
string waiter_code [4] ; 
string numStr ; 
string nameStr ; 
int num ;
/* Variables for price list */
const float filter = 4.50 ; 
const float cappuccino = 9.50 ; 
const float mocha_java = 10.00 ; 
const float espresso = 6.00 ; 
const float cappuccino_skinny = 9.00 ; 
	

/* Variables for wage*/
int total_orders [4] ; 
float total_sales [4] ; 
float wage[4] ; 

/* Other variables*/
char ans ; 


string intToString (int i) 
{ 
	stringstream out ; 
	string s ; 
	out << i ; 
	s = out.str() ; 
	return s ; 
} 

void waiterWage () 
{ 
	for (int i = 0 ; i < 4 ; i++) 
	{ 
		wage [i] = total_sales[i]*0.15 ; 
		cout << waiter_code [i] << setw (5) << " : WAGE " << setw (9) << setprecision (2) << wage [i] << endl ; 
	}
	cout << endl ; 
} 

void totalOrders ()
{ 
	for (int i = 0 ; i < 4 ; i++) 
	{ 
		cout << waiter_code [i] << setw(5) << " : ORDERS " << setw (9) << total_orders [i] << endl; 
	}
	cout << endl ; 
}

bool verifyWaiter (string waiter)
{ 
	bool test = false ; 
	count = 0 ; 
		
		while (test != true && count <= 4) 
		{
			if (waiter != waiter_code [count]) 
			{
				test = false ; 
				count ++ ; 
			} 
			else if (waiter == waiter_code [count]) 
			{ 
				test = true ;  
			} 
			
		}
		if (count > 4 )
		{ 
			test = false ; 
			count = 0 ; 
		} 
		return test ; 
}

void declareWaiter () 
{ 
	for (int i = 0 ; i < 4 ; i++) 
	{	
		srand((unsigned)time(0)) ; // generates random numbers instead of just one number NB to use with rand() 
		cout << "Enter waiters names : " ; 
		cin >> nameStr ; 
		name = nameStr.at(0) ; // getting first letter of name ; 
		nameStr = toupper(name) ; // making it upper case 
		num = (rand()%50)+1 ; // assigning a random integer value to num between 1 - 50 
		numStr = intToString (num) ; // casting integer value num into a string 
		waiter_code [i] = nameStr + numStr ; // storing waiters first letter of name with random number 
		File << waiter_code [i] << endl ; 
		total_sales [i] = 0 ; 
		total_orders [i] = 0 ; 
	}
	File.close () ; 
}


int main () 
{	
	declareWaiter () ; 
	string temp ; 
	do 
	{	
		bool test ; 
		cout << "Enter waiter code eg R43\n" << endl ; 
		cin >> temp ; 
		test = verifyWaiter (temp) ; 
		if (test == true) 
		{ 
			cout << setw(16) <<"Menu" << endl; 
			cout << "-----------------------------" <<endl ; 
			cout << "A. Make new order" << endl ; 
			cout << "B. View waiters total orders" << endl ; 
			cout << "C. View waiters wage" << endl ; 
			cout << "Q. Quit" << endl ; 
			cout << "OPTION : " ; 
			cin >> ans ; 
			ans = toupper (ans) ; 
			//while (ans != 'Q') 
			//{
				switch (ans) 
				{
				case 'A':
					while (ans != 'F') 
					{
						char order ;  
						cout << "A. Filter Coffee\nB. Cappucino\nC. Mocha Java\nD. Espresso\nE. Cappucino Skinny\nF. Finished order(s)\n" << endl ; 
						cout << "Enter order : " ;
						cin >> order ; 
						switch (order) 
						{
						case 'A':
							total_sales [count] += filter ; 
							total_orders [count] ++ ; 
							break ; 
						case 'B':
							total_sales [count] += cappuccino ;
							total_orders [count] ++ ; 
							break ; 
						case 'C':
							total_sales [count] += mocha_java ; 
							total_orders [count] ++ ; 
							break ; 
						case 'D':
							total_sales [count] += espresso ; 
							total_orders [count] ++ ; 
							break ; 
						case 'E':
							total_sales [count] += cappuccino_skinny ; 
							total_orders [count] ++ ; 
							break ; 
						case 'F':
							ans = 'F' ; 
							break ; 
						default:
							cout << "Incorrect order, try again\n" << endl ; 
							break ; 
						} 
					}
					break ; 
				case 'B':
					totalOrders () ; 
					break ; 
				case 'C':
					waiterWage () ; 
					break ; 
				case 'Q':
					ans = 'Q' ; 
					break ; 
				default :
					cout << "Incorrect option, try again\n\n" << endl ; 
					cout << setw(16) <<"Menu" << endl; 
					cout << "-----------------------------" <<endl ; 
					cout << "A. Make new order" << endl ; 
					cout << "B. View waiters total orders" << endl ; 
					cout << "C. View waiters wage" << endl ; 
					cout << "Q. Quit" << endl ; 
					cout << "OPTION : " ; 
					cin >> ans ; 
					ans = toupper (ans) ; 
					break ; 
				}
			//}
		}
		else if (temp == "QUIT") 
		{
			 
		}
		else
		{
			cout << "INCORRECT WAITER CODE" << endl ;
		}
	}
	while (temp != "QUIT") ; 
}



One thing I noticed glancing over your code...you should not seed the random number generator every loop; just seed it once at the beginning of your program.
I thought i should have done that, but wasnt too sure. Thanks :)
Topic archived. No new replies allowed.