Have to type code simulation for waiting at restaurant but can't stop the loop.Here's my assignment we are only using ofstream and iostream libs:
Program #5
Using what you have learned with if statements and loops, you will design a simulation based on a trip to The Outback (which I like to do frequently on Friday and/or Saturday evenings).
You will accept as input a wait time, in minutes, to be seated at An Outback Steakhouse.
You will do a loop to simulate each minute that passes during waiting to be seated.
If you receive a wait time of longer than an hour, output to the screen "Going to another place to eat", otherwise....
You will loop and...
Output to the screen "Getting drinks at the bar" if 5 minutes pass
Output to the screen "Getting appetizers at the bar" if 15 minutes pass
Output to the screen "Deciding to eat at the bar" if 30 minutes pass
Output to the screen "Order another round of drinks" if 45 minutes pass
That's it.
Sample Run #1:
Please enter a wait time at Outback Steakhouse: 75
Going to another place to eat...
Sample Run #2:
Please enter a wait time at Outback Steakhouse: 15
Getting drinks at the bar
Getting appetizers at the bar
Sample Run #3:
Please enter a wait time at Outback Steakhouse: 55
Getting drinks at the bar
Getting appetizers at the bar
Deciding to eat at the bar
Order another round of drinks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
//
// main.cpp
// Homework 5
//
// Created by Patrick Stark on 11/5/15.
// Copyright © 2015 Patrick Stark. All rights reserved.
//
#include <iostream>
using namespace std;
int main ()
{
{
int intWaitTime;
cout << "Enter time to wait for seating: ";
cin >> intWaitTime;
if (intWaitTime > 60)
cout << "Going to another place to eat!" << endl;
}
int intArrival = 0;
intArrival++;
while (intArrival > 5)
cout << "Getting drinks at the bar."<< endl;
while (intArrival > 15)
cout << "Getting appetizers at the bar." << endl;
while (intArrival > 30)
cout << "Deciding to eat at the bar." << endl;
while (intArrival > 45)
cout << "Order another round of drinks." << endl;
return 0;
}
|