syntax error but i have no idea why?

I have a do while loop with a switch statement nested in it but for some reason the squiggly bracket at the end of the switch statement is saying it is a syntax error when it appears to be in the right place? It only says there is an error when i build it.

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
  #include "stdafx.h"

using namespace std;

int main()
{
    
	int list[12];
	int option;

	cout << "Enter 12 numbers : ";

	for (int i = 0; i < 12; i++)
	{

		cin >> list[i];

	}

	do
	{
		
		cout << "\t\tMenu\n";
		cout << "\t0.Display\n";
		cout << "\t1.Total\n";
		cout << "\t2.Largest\n";
		cout << "\t99.Exit\n";
		cout << "\t\t Option ? ";
		cin >> option;


		switch (option)
		{
		case 0:

			cout << "Contents\n";


			for (int i = 0; i < 12; i++)

		        cout << list[i] << endl;



		case 1:



		case 2:



		case 99:
		}




		}while (option != 99);


	
	
	return 0;
}


its the squiggly bracket under "case 99" is the problem.
None of your cases have breaks. Each case needs to end with a break (of some sort).
Last edited on
Try adding a semicolon (a null statement) before the closing brace of the switch block. When your code is completed, you should have some actual statement(s) in there instead.
Topic archived. No new replies allowed.