Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void menu(){
- const int colWidth[2] = { 10, 5 };
- struct {
- char* itemName;
- float itemPrice;
- }food[7] = {
- "Hamburger", 6.0,
- "Hotdog", 4.5,
- "Peanuts", 3.75,
- "Popcorn", 5.5,
- "Soda", 2.8,
- "Chips", 1.0,
- "Water", 2.0
- }, *p_food = &food[0];
- std::cout << "Baseball Game Snacks" << std::endl;
- for (int i = 0; i < (sizeof(food) / sizeof(food[0])); *p_food++)
- std::cout
- << std::fixed << std::setprecision(2) << std::right
- << ++i << ")"
- << std::setw(colWidth[0]) << (*p_food).itemName << ":"
- << std::setw(colWidth[1]) << "$" << (*p_food).itemPrice << "\n";
- std::cout << "\n8) END ORDER" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement