Advertisement
wigllytest

Untitled

Aug 7th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. int width, length, height;
  9. cin >> width >> length >> height;
  10. int apVolume = width * length * height;
  11.  
  12. string command;
  13. cin >> command;
  14.  
  15. while (command != "Done")
  16. {
  17. int box = stoi(command);
  18. apVolume -= box;
  19.  
  20. if (apVolume < 0)
  21. {
  22. break;
  23. }
  24. cin >> command;
  25. }
  26.  
  27. if (apVolume >= 0)
  28. {
  29. cout << apVolume << " Cubic meters left.";
  30. }
  31. else
  32. {
  33. cout << "No more free space! You need " << abs(apVolume) << " Cubic meters more.";
  34. }
  35.  
  36.  
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement