/**************************************************************** CS177/457 C++ Programming, Fall 1998 Lab 2. Modify an existing program Here, below, is source code for a program that calculates a number of seats given a number of rooms and the number of seats per room. Follow these steps to complete the assignment. These steps are essentially the same as the last lab assignment, except for step 2. 1. Edit the source code from this message exactly as in your first assignment. 2. Use the editor to change the purpose of the program to calculate how many hot dogs a child can get given a total number of hot dogs, and a number of children. These two numbers should be read from the keyboard and the results of the calculation printed on the screen. The program should print both the number of hots dogs per child, and the number of hots dogs left over. For example: 64 hot dogs divided among 15 children gives 4 each with 4 left over. You can use both integer division (the / operator) and the modulus, or remainder operator % to do this. See page 77 for examples. 3. Compile and run the program several times with different numbers to test its results. 4. Run the program once more with the example input (64 and 15) but with redirected output to a file, and insert the output into a copy of the source code file. 5. Print the file with the source code and output and hand it to me (RTH). 6. Mail the same file to our grader (login junpu). Points to note: o Use different file names from those used in Lab 1, so that you can perserve your work from last week. o You may get compilation errors and/or warnings. Pay attention to these messages because you program may not run correctly, or at all, because of these errors. o Don't forget to put your name (at least) in the file header comment. o Change the file header comment to reflect the new use of the program. o Change the user prompts (the text strings printed by the program before asking for input) to suit the new purpose. o The caculation is obviously different for the new use. o Make sure your output is easily read and understood. *******************************************************************/ ///////////////////////////////////////////////////////////////////// // This program reads a number of rooms and the number of seats in // // a room and prints the total number of seats. // // Roger Hartley, September 1999 // ///////////////////////////////////////////////////////////////////// #include int main() { // give the user general instructions cout << "Press return after entering a number." << endl; // ask the user for the number of pods cout << "Enter the number of rooms:" << endl; int numberOfRooms; cin >> numberOfRooms; // ask the user for the number of seats in each room cout << "Enter the number of seats in a room:" << endl; int seatsPerRoom; cin >> seatsPerRoom; // calculate the total number of peas int totalSeats; totalSeats = numberOfRooms * seatsPerRoom; // print the result cout << "If you have "; cout << numberOfRooms; cout << " rooms " << endl; cout << "and "; cout << seatsPerRoom; cout << " seats in each room, then" << endl; cout << "you have "; cout << totalSeats; cout << " seats in all the rooms." << endl; return 0; }