Advertisement
krasio12356

Spaceship

Apr 16th, 2018
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5.                                        // Spaceship
  6. int main()
  7. {
  8.     double w, l, h, avh;
  9.     cin >> w >> l >> h >> avh;
  10.     double rocketvolume = w * l * h;
  11.     double roomvolume = (avh + 0.4) * 2 * 2;
  12.     double answer = floor(rocketvolume / roomvolume);
  13.     if (answer > 10)
  14.     {
  15.         printf("The spacecraft is too big.\n");
  16.     }
  17.     else if (answer < 3)
  18.     {
  19.         printf("The spacecraft is too small.\n");
  20.     }
  21.     else
  22.     {
  23.         printf("The spacecraft holds %.0f astronauts.\n", answer);
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement