How To Create a Menu

Help me i need to create a Menu Like this

Menu

[1] Seasons of the year

[2] BINGO

[3] My Loop

[4] Exit
The program can only exit when the user chooses 4

Then When i Input 1 it will run the program that i created for the SEASON OF THE YEAR same with 2 and 3 :)


Last edited on
Show some effort, and learn to use code tags.
Take out the system PAUSE, only beginners do that.
Test your while loop, doesn't look like it works, can't give a line number without code tags.
I recommend write the menu and then the program....
I am a beginner dude Im a 1st year I.T Student :)
All he is asking you to do is edit your code and put


[ c o d e ] ~Insert Code Here~ [ / c o d e ]

excecpt where you remove all the spaces. You could be an art student. It's very easy.

That way it looks like this. MUCH EASIER TO READ

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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#include<iostream>
using namespace std;

int main()
{

int x;
cout<<"Input a number"<<endl;
cin>>x;

while(x < 1 || x > 12){
cout << "Enter 1-12: ";
cin >> x;
}

if(x == 1){
cout<<"January is Winter"<<endl;
cout<<"HAPPY NEW YEAR"<<endl;
}
else if(x == 2){
cout<<"Febuary is WINTER"<<endl;
cout<<"Happy Valentine's Day"<<endl;
}
else if(x == 3){
cout<<"March is SPRING"<<endl;
cout<<"Congratulations, Graduates!"<<endl;
}
else if(x == 4){
cout<<"April is SPRING"<<endl;
}
else if(x == 5){
cout<<"May is SPRING"<<endl;
}
else if(x == 6){
cout<<"June is SUMMER"<<endl;
}
else if(x == 7){
cout<<"July is SUMMER"<<endl;
}
else if(x == 8){
cout<<"August is SUMMER"<<endl;
}
else if(x == 9){
cout<<"September is FALL"<<endl;
}
else if(x == 10){
cout<<"October is FALL"<<endl;
}
else if(x == 11){
cout<<"November is FALL"<<endl;
}
else if(x == 12){
cout<<"December is WINTER"<<endl;
}

return 0;
}

This is The Bingo 
#include<iostream>
using namespace std;

int main()
{
int x;
cout<<"Input a number"<<endl;
cin>>x;

switch(x)
{
case 1:
cout<<"That is Letter B"<<endl;
break;
case 2:
cout<<"That is Letter B"<<endl;
break;
case 3:
cout<<"That is Letter B"<<endl;
break;
case 4:
cout<<"That is Letter B"<<endl;
break;
case 5:
cout<<"That is Letter B"<<endl;
break;
case 6:
cout<<"That is Letter B"<<endl;
break;
case 7:
cout<<"That is Letter B"<<endl;
break;
case 8:
cout<<"That is Letter B"<<endl;
break;
case 9:
cout<<"That is Letter B"<<endl;
break;
case 10:
cout<<"That is Letter B"<<endl;
break;
case 11:
cout<<"That is Letter B"<<endl;
break;
case 12:
cout<<"That is Letter B"<<endl;
break;
case 13:
cout<<"That is Letter B"<<endl;
break;
case 14:
cout<<"That is Letter B"<<endl;
break;
case15:
cout<<"That is Letter B"<<endl;
break;
case 16:
cout<<"That is Letter I"<<endl;
break;
case 17:
cout<<"That is Letter I"<<endl;
break;
case 18:
cout<<"That is Letter I"<<endl;
break;
case 19:
cout<<"That is Letter I"<<endl;
break;
case 20:
cout<<"That is Letter I"<<endl;
break;
case 21:
cout<<"That is Letter I"<<endl;
break;
case 22:
cout<<"That is Letter I"<<endl;
break;
case 23:
cout<<"That is Letter I"<<endl;
break;
case 24:
cout<<"That is Letter I"<<endl;
break;
case 25:
cout<<"That is Letter I"<<endl;
break;
case 26:
cout<<"That is Letter I"<<endl;
break;
case 27:
cout<<"That is Letter I"<<endl;
break;
case 28:
cout<<"That is Letter I"<<endl;
break;
case 29:
cout<<"That is Letter I"<<endl;
break;
case 30:
cout<<"That is Letter I"<<endl;
break;
case 31:
cout<<"That is Letter N"<<endl;
break;
case 32:
cout<<"That is Letter N"<<endl;
break;
case 33:
cout<<"That is Letter N"<<endl;
break;
case 34:
cout<<"That is Letter N"<<endl;
break;
case 35:
cout<<"That is Letter N"<<endl;
break;
case 37:
cout<<"That is Letter N"<<endl;
break;
case 38:
cout<<"That is Letter N"<<endl;
break;
case 39:
cout<<"That is Letter N"<<endl;
break;
case 40:
cout<<"That is Letter N"<<endl;
break;
case 41:
cout<<"That is Letter N"<<endl;
break;
case 42:
cout<<"That is Letter N"<<endl;
break;
case 43:
cout<<"That is Letter N"<<endl;
break;
case 44:
cout<<"That is Letter N"<<endl;
break;
case 45:
cout<<"That is Letter N"<<endl;
break;
case 46:
cout<<"That is Letter G"<<endl;
break;
case 47:
cout<<"That is Letter G"<<endl;
break;
case 48:
cout<<"That is Letter G"<<endl;
break;
case 49:
cout<<"That is Letter G"<<endl;
break;
case 50:
cout<<"That is Letter G"<<endl;
break;
case 51:
cout<<"That is Letter G"<<endl;
break;
case 52:
cout<<"That is Letter G"<<endl;
break;
case 53:
cout<<"That is Letter G"<<endl;
break;
case 54:
cout<<"That is Letter G"<<endl;
break;
case 55:
cout<<"That is Letter G"<<endl;
break;
case 56:
cout<<"That is Letter G"<<endl;
break;
case 57:
cout<<"That is Letter G"<<endl;
break;
case 58:
cout<<"That is Letter G"<<endl;
break;
case 59:
cout<<"That is Letter G"<<endl;
break;
case 60:
cout<<"That is Letter G"<<endl;
break;
case 61:
cout<<"That is Letter O"<<endl;
break;
case 62:
cout<<"That is Letter O"<<endl;
break;
case 63:
cout<<"That is Letter O"<<endl;
break;
case 64:
cout<<"That is Letter O"<<endl;
break;
case 65:
cout<<"That is Letter O"<<endl;
break;
case 66:
cout<<"That is Letter O"<<endl;
break;
case 67:
cout<<"That is Letter O"<<endl;
break;
case 68:
cout<<"That is Letter O"<<endl;
break;
case 69:
cout<<"That is Letter O"<<endl;
break;
case 70:
cout<<"That is Letter O"<<endl;
break;
case 71:
cout<<"That is Letter O"<<endl;
break;
case 72:
cout<<"That is Letter O"<<endl;
break;
case 73:
cout<<"That is Letter O"<<endl;
break;
case 74:
cout<<"That is Letter O"<<endl;
break;
case 75:
cout<<"That is Letter O"<<endl;
break;
default:
cout<<"Exit"<<endl;	
}
system("PAUSE");
return 0;

}

This is the My loop

#include <iostream>
using namespace std;

int main()
{
int num = 0;
float input = 0, sum = 0;

while (input != -1)
{
cout<<"Input a number No 1:"<<endl;
cin >> input;
cout<<"Input a number No 2:"<<endl;
cin>> input;
cout<<"Input a number No 3:"<<endl;
cin>> input;
if( input !=1 )
{
num++;
sum += input;
cout << " The Sum is: " << sum+input<< endl;
cout << " The Average is: " << sum/num << endl;
} 
}

return 0;
}
Last edited on
http://www.cplusplus.com/forum/beginner/179779/


Duplicate post. Please don't do this, it is ultimately a time waster.

Also, what do take main() to mean ?

If you use a modulus expression, you could do the BINGO thing with 5 LOC

These are the compile errors I get when using the gear icon on the top right of the code:

59:1: error: 'This' does not name a type In function 'int main()':
63:5: error: redefinition of 'int main()'
4:5: note: 'int main()' previously defined here
113:1: warning: label 'case15' defined but not used [-Wunused-label] At global scope:
301:1: error: 'This' does not name a type In function 'int main()':
306:5: error: redefinition of 'int main()'
4:5: note: 'int main()' previously defined here


This should have been your job: If you have compile errors, then post them here.

Have a read of the tutorial at the top left of this page. Look up the things I mentioned in the reference.
Im really sorry guys I'm a newbee sorry sorry :(
We're really sorry too. We don't mean to be harsh. You shouldn't be expected to know everything. For now on, however, it would be really nice if you just try to type


[ c o d e ]

~ copy and paste your code here~

[ / c o d e ]

before you post. It makes it easier for us to quickly skim your code.
Topic archived. No new replies allowed.