Write a menu based program to create a list of record using stack and queue concept. In your program, you must give an option to the user either to create a list of record using stack concept or queue concept. The object needed to impement in the code are shoes. program: int main () { char selection; int option; do { cout << "\n Main Menu"; cout << "\n ========="; cout << "\n Q - Queue"; cout << "\n S - Stack"; cout << "\n X - Exit \n"; cout << "\n Enter selection: "; // read the input cin >> selection; switch (toupper(selection)) { case 'Q': do{ cout << "\n Queue List Menu"; cout << "\n ========="; cout << "\n 1 - Enqueue"; cout << "\n 2 - Dequeue"; cout << "\n 3 - Queue front"; cout << "\n 4 - Queue rear"; cout << "\n 5 - View All"; cout << "\n 6 - Back to main menu \n"; cout << "\n\n Enter selection: "; cin>>option; switch(option) { case 6: cout<<"\nBack to Main Menu\n\n"; break; default: cout << "\n Invalid selection"; } }while (option != 6); break; case 'S': cout << "\n Stack"; break; case 'X': cout << "\n To exit the menu"; break; // other than A, M, D and X... default: cout << "\n Invalid selection"; } }while(toupper(selection) != 'X'); return 0; }
Write a menu based program to create a list of record using stack and queue concept. In your program, you must give an option to the user either to create a list of record using stack concept or queue concept. The object needed to impement in the code are shoes.
program:
int main ()
{
char selection;
int option;
do
{
cout << "\n Main Menu";
cout << "\n =========";
cout << "\n Q - Queue";
cout << "\n S - Stack";
cout << "\n X - Exit \n";
cout << "\n Enter selection: ";
// read the input
cin >> selection;
switch (toupper(selection))
{
case 'Q': do{
cout << "\n Queue List Menu";
cout << "\n =========";
cout << "\n 1 - Enqueue";
cout << "\n 2 - Dequeue";
cout << "\n 3 - Queue front";
cout << "\n 4 - Queue rear";
cout << "\n 5 - View All";
cout << "\n 6 - Back to main menu \n";
cout << "\n\n Enter selection: ";
cin>>option;
switch(option)
{
case 6: cout<<"\nBack to Main Menu\n\n";
break;
default: cout << "\n Invalid selection";
}
}while (option != 6);
break;
case 'S': cout << "\n Stack";
break;
case 'X': cout << "\n To exit the menu";
break;
// other than A, M, D and X...
default: cout << "\n Invalid selection";
}
}while(toupper(selection) != 'X');
return 0;
}

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









