steamengines

prob 11

Oct 2nd, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. //Christian Ballard
  2. //COSC 1330
  3. //Problem 11 Calculates and displays the number of single rolls of wallpaper needed to cover a room
  4.  
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     //Declarations
  11.     double length = 0.0;
  12.     double width = 0.0;
  13.     double height = 0.0;
  14.     double rollSqrft = 0.0;
  15.     double numRolls = 0.0;
  16.     double totalArea = 0.0;
  17.  
  18.     //Inputs
  19.     cout << "What is the length of the room?" << endl;
  20.     cin >> length;
  21.     cout << "What is the width of the room?" << endl;
  22.     cin >> width;
  23.     cout << "What is the height of the room?" << endl;
  24.     cin >> height;
  25.     cout << "How many square feet will a single roll cover?" << endl;
  26.     cin >> rollSqrft;
  27.  
  28.     //Calculations
  29.     totalArea = (length+width+height)*rollSqrft;
  30.     numRolls = (totalArea/rollSqrft);
  31.  
  32.  
  33.  
  34.     //Output
  35.     cout << "Number of Single Rolls" << endl << numRolls << endl;
  36.  
  37.  
  38.  
  39.  
  40.     system("pause");
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment