ifstream infile;
infile.open("menu.txt");
do
{
getline(infile, menu[i].menuItem);
infile >> menu[i].menuPrice;
infile.get(); // to get of the eol character after the priceinfile >> menu[i].menuPrice;
menu[i].selected = false;
i++;
} while (infile);// set the selected member to false
cout << "Menu Choices" << endl;
for (i = 0; i < 8; i++)
{
cout << fixed << setprecision(2);
cout << i + 1 << "." << menu[i].menuItem << setw(25) << right << menu[i].menuPrice << endl;
}
cout << endl << "Or 9 to Exit" << endl << endl;
do{
cout << "Enter the number of the item you would like: ";
cin >> choice;
menu[choice - 1].selected = true;
}while (choice != 9);
for (i = 0; i < 8; i++)
{
if(menu[choice - 1].selected = true)
cout << i + 1 << "." << menu[choice - 1].menuItem << setw(25) << right << menu[i].menuPrice << endl;
}