Help with do...while loop. Expected while?

Please copy these code to your compiler and help me figure it out, I don't know what's wrong with it. I spent 3 hours to find solution and seems better to find someone check my code. Thanks first!

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
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;

void main()
{
	int StaffSelection;
	bool loop = true;

								do
								{
									system ("cls");
									cout<<"1. Reserve tickets"<<endl;
									cout<<"2. Query for suitable flight"<<endl;
									cout<<"3. Modify reservation"<<endl;
									cout<<"4. Cancel reservation"<<endl;
									cout<<"5. (Return)"<<endl;
								    cin>>StaffSelection;
									switch(StaffSelection)
									{
									case 1:
										break;
									case 2:
										break;
									case 3:
										break;
									case 4:
										break;
									case 5:
										cout<<"\nReturning to main menu ...";
							            Sleep(700);
									}
								 }
						}while(StaffSelection!=5);
							   //  break;
			//}
	//}while(loop=true);
//} 
Last edited on
What's the problem? What is the behaviour you're seeing? How does it differ from what you expect?
Well you've got one extra closing brace before the while(...) on line #35. You need to move the while to line #34
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I didn't realize it
Topic archived. No new replies allowed.