can't find why my case, break, and default became illegal

Hello everyone! Can you please help me find why my case, break, and default became illegal?

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

#include <iostream>
using namespace std;
const float Kerrimo_Bulilit=25.00;
const float Kerrimo_Budget=43.00;
const float Kerrimo_Regular=53.00;
const float Kerrimo_Jumbo=73.00;

int main ()
int order=0, quantity=0, order1, a=1;
	float totalAmount, change;
	float payment;
	char letter, Y, y, N, n;

menu:
	do
	{
		cout<<"Welcome To Kerrimo!"<<endl;
		cout<<"List of Menu:"<<endl;
		cout<<"(press 1) for Bulilit----P25.00"<<endl;
		cout<<"(press 2) for Budget----P43.00"<<endl;
		cout<<"(press 3) for Regular----P53.00"<<endl;
		cout<<"(press 4) for Jumbo----P73.00"<<endl;
		cin>>a;
	}
	switch (a);{
		case 1:
			cout<<"You Ordered Kerrimo Bulilit for P25.00"<<endl;
			cout<<"How many Kerrimo Bulilit do you want?"<<endl;
			cin>>quantity;
			quantity=order;
			order1=quantity*Kerrimo_Bulilit;
			totalAmount=order1;
			cout<<"The price is"<<totalAmount<<endl;
			break;

		case 2:
			cout<<"You Ordered Kerrimo Budget for P43.00"<<endl;
			cout<<"How many Kerrimo Budget do you want?"<<endl;
			cin>>quantity;
			quantity=order;
			order1=quantity*Kerrimo_Budget;
			totalAmount=order1;
			cout<<"The price is"<<totalAmount<<endl;
			break;

		case 3:
			cout<<"You Ordered Kerrimo Regular for P53.00"<<endl;
			cout<<"How many Kerrimo Regular do you want?"<<endl;
			cin>>quantity;
			quantity=order;
			order1=quantity*Kerrimo_Regular;
			totalAmount=order1;
			cout<<"The price is"<<totalAmount<<endl;
			break;

		case 4:
			cout<<"You Ordered Kerrimo Jumbo for P73.00"<<endl;
			cout<<"How many Kerrimo Jumbo do you want?"<<endl;
			cin>>quantity;
			quantity=order;
			order1=quantity*Kerrimo_Jumbo;
			totalAmount=order1;
			cout<<"The price is"<<totalAmount<<endl;
			break;

		default:
			cout<<"We don't have that in the menu!"<<endl;
			break;
	}
        cout<<"Do you want another transaction?"<<endl;
	cout<<"Press Y/y if YES and N/n if NO" << endl;
	cin>>letter;
	if ((Y==y)||(y==Y))
	goto menu;
	if ((N==n)||(n==N))
	goto payment;
	
payment:
	cout<<"Enter your payment:"<<endl;
	cin>>payment;
	if (payment<totalAmount)
		cout<<"Insufficent Amount!"<<endl;
	goto payment;
	if (payment>=totalAmount)
		change=payment-totalAmount;
	
	
	
	cout << "Thank You! Come Again" << endl;
		
return 0;
}


Here is what the compiler said:

Error 2 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 39 project_in_Com.prog

Error 5 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 47 project_in_Com.prog

Error 6 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 49 project_in_Com.prog

Error 9 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 57 project_in_Com.prog

Error 10 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 59 project_in_Com.prog

Error 13 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 67 project_in_Com.prog

Error 14 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 69 project_in_Com.prog

Error 17 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 77 project_in_Com.prog

Error 18 error C2047: illegal default c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 79 project_in_Com.prog

Error 19 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 81 project_in_Com.prog

Error 21 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 85 project_in_Com.prog

Error 24 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 93 project_in_Com.prog

Error 25 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 95 project_in_Com.prog

Error 28 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 103 project_in_Com.prog

Error 29 error C2046: illegal case c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 105 project_in_Com.prog

Error 32 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 113 project_in_Com.prog

Error 33 error C2047: illegal default c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 115 project_in_Com.prog

Error 34 error C2043: illegal break c:\users\anj\documents\visual studio 2008\projects\kerrimo\project_in_com.prog\kerrimo project.cpp 117 project_in_Com.prog
Last edited on
Remove the semicolon on line 25.
It's still syntax error.
so, where is the start of the function? int main() {?

lines 73/75 do not make sense. What you want is this if ((letter == 'Y')||(letter == 'y'))
You are missing the while in the do-while loop. do { ... } while ( ... );
Last edited on
It's for selection whether the user will order again or not.
If you are speaking about syntax errors then please report which error messages the compiler issues and in which statements of the program.
thanks peter, but there is another problem, the compiler said that my case is illegal and so as the break. What can i do to correct it?
Topic archived. No new replies allowed.