Patrick B. answered 06/23/21
Math and computer tutor/teacher
using namespace std;
#include <iostream>
#include <string>
#define NUM_SIDE_ITEMS (16)
string Items[] = {"FRIES","COLE SLAW","MACARONI SALAD","POTATO SALAD","PASTA SALAD","BAKED BEANS","CORN","ONION RINGS","MASHED POTATO",
"BAKED POTATO","FRIED OKRA","FRIED MUSHROOMS","STUFFED PEPPERS","COLLARD GREENS","OXTAIL","MIXED VEGETABLE SALAD"};
int Menu()
{
int n = -1;
while (n<0 || n>16)
{
cout << "*************************************" << endl;
cout << " PLEASE CHOOSE A SIDE ITEM " << endl;
cout << "*************************************" << endl;
cout << " <1> FRIES " << endl;
cout << " <2> COLE SLAW " << endl;
cout << " <3> MACARONI SALAD " << endl;
cout << " <4> POTATO SALAD " << endl;
cout << " <5> PASTA SALAD " << endl;
cout << " <6> BAKED BEANS " << endl;
cout << " <7> CORN " << endl;
cout << " <8> ONION RINGS " << endl;
cout << " <9> MASHED POTATO " << endl;
cout << " <10> BAKED POTATO " << endl;
cout << " <11> FRIED OKRA " << endl;
cout << " <12> FRIED MUSHROOMS " << endl;
cout << " <13> STUFFED PEPPERS " << endl;
cout << " <14> COLLARD GREENS " << endl;
cout << " <15> OXTAIL " << endl;
cout << " <16> MIXED VEGETABLE SALAD " << endl;
cout << "**************************************" << endl;
cout << " INPUT YOUR SELECTION OR ZER0 TO QUIT :>";
cin >> n;
if (n<0 || n>NUM_SIDE_ITEMS)
{
cout << "Invalid Selection - Try again ...." << endl;
}
} //while
return(n);
}
int main()
{
int iMenuResponse=-1;
bool items[16];
for (int iLoop=0; iLoop<NUM_SIDE_ITEMS; iLoop++){ items[iLoop]=false; }
while ((iMenuResponse = Menu())!=0)
{
switch (iMenuResponse)
{
case 0:
{
break;
}
default:
{
int iIndexPos = iMenuResponse-1;
items[iIndexPos]=false;
if (items[iIndexPos])
{
cout << Items[iIndexPos] << " is already ordered " << endl;
}
else
{
items[iIndexPos]=true;
cout << Items[iIndexPos] << " added to your order " << endl;
}
}
}
}
for (int iLoop=0; iLoop<NUM_SIDE_ITEMS; iLoop++)
{
if (items[iLoop])
{
cout << Items[iLoop] << endl;
}
}
}