Advertisement
Cool_Karate_Man

Untitled

Sep 19th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. /**Student Name: Andrew Meade
  2.  
  3. *Date Completed: 9/18/2014
  4.  
  5. *Project No.: Chapter 2 PP; problem 5 on page 106
  6.  
  7. *Project Description: Fire Regulation Room Capacity
  8.  
  9. **/
  10.  
  11. #include <iostream>
  12. using namespace std;
  13.  
  14. int main()
  15. {
  16. //Declaring variables
  17. double capacity, attendees, overage;
  18. char ans;
  19. do
  20. {
  21.  
  22. //Greeting the user and instructing them what to input.
  23. cout << "Hello! Please enter the room's maximum capacity.\n";
  24. cin >> capacity;
  25. cout << "Thank you. Now, please enter the number of people attending the meeting.\n";
  26. cin >> attendees;
  27. cout << "Thank you.\n";
  28. //An if/else statement to determine what course of action the program should take.
  29. if (attendees > capacity)
  30. {
  31. overage = attendees - capacity;
  32. cout << "The meeting can not be held as planned due to violation of";
  33. cout<< "\nfire safety regulations pertaining to an overage in maximum room capacity.\n";
  34. cout << overage;
  35. cout << " people will need to be excluded in order to meet regulation standards.\n";
  36. }
  37. else
  38. {
  39. cout << "It is legal to hold a meeting in this room if ";
  40. cout << attendees;
  41. cout << " people attend, since the room's maximum capacity is ";
  42. cout << capacity;
  43. cout << " as per fire regulation standards.\n";
  44. }
  45.  
  46. cout << "Do you want to check another room?\nEnter Y for yes or N for no.\n";
  47. cin >> ans;
  48.  
  49. //A repeating loop as long as they enter in the correct response to continue on
  50. }while (ans == 'Y'||ans == 'y');
  51.  
  52. //Thanking the user for using the program
  53. cout << "Thanks for using the program! Goodbye!\n";
  54.  
  55. system ("pause");
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement