0
How to make any menu driven program in C
any menu driven program using switch case
2 ответов
+ 6
#include <iostream>
using namespace std;
void menu();
int main()
{
int user_choice;
menu();
cout << "Please input your choice of selection.";
cin >> user_choice;
switch (user_choice)
{
case 1: cout << "🍪🍪🍪"; break;
case 2: cout << "🍪🍪🍪🍪🍪🍪🍪"; break;
case 3: cout << "🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪🍪"; break;
default: cout << "No cookies for you.";
}
return 0;
}
void menu()
{
cout << "Welcome to the cookie program!" << endl;
cout << " 1) Cookies " << endl;
cout << " 2) More cookies!" << endl;
cout << " 3) Too many cookies!" << endl;
}
+ 1
lol