Sv: consolmenu c++
Svara
int main()
{
int val;
while (true) {
cout << "Vad vill du göra?" << endl << "1. Köra rutinen" << endl << "2. Avsluta" << endl << "> ";
val = 0;
cin >> val;
if(cin.fail()) {
cin.clear();
cin.ignore(1000, '\n');
}
switch(val) {
case 1:
rutin();
break;
case 2:
exit();
}
}
}