Advertisement
Spocoman

Spaceship

Sep 22nd, 2023
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     double width, length, height, averageHeight;
  7.     cin >> width >> length >> height >> averageHeight;
  8.  
  9.     double spaceshipVolume = width * length * height;
  10.     double astronautVolume = (averageHeight + 0.4) * 2 * 2;
  11.     int team = (int)(spaceshipVolume / astronautVolume);
  12.  
  13.     if (team < 3) {
  14.         cout << "The spacecraft is too small.\n";
  15.     }
  16.     else if (team > 10) {
  17.         cout << "The spacecraft is too big.\n";
  18.     }
  19.     else {
  20.         cout << "The spacecraft holds " << team << " astronauts.\n";
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement