How to create main menu in c++ that takes the value and performs the operation according to that value... | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to create main menu in c++ that takes the value and performs the operation according to that value...

It takes first value and perform the operation according to that value and after performing it asks again that now what to do exit or else...??? (PLEASE HELP)

9th Jan 2018, 5:10 PM
harsh mangal
harsh mangal - avatar
2 Antworten
+ 2
ValueType value = getInput(); while(value != actionExit) { switch (value) { case actionOne: performActionOne(); break; // and so on ... }; value = getInput(); }
9th Jan 2018, 5:17 PM
deFault
+ 2
do it with if else, example: int action = 0; cin>> action; if (action == 1) //do something else if(action == 2) //do something else //do something . . .
9th Jan 2018, 5:17 PM
Mustafa K.
Mustafa K. - avatar