Ledger Nano X - The secure hardware wallet
SHARE
TWEET

C++, Problem 7 - Fish Tank

JOHNYTHEWINNER Jan 22nd, 2020 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4.  
  5. int main()
  6. {
  7.     int lenght;
  8.     do
  9.     {
  10.         cin.clear();
  11.         cin >> lenght;
  12.     }
  13.     while (cin.bad() || lenght <10 || lenght > 500);
  14.     int width;
  15.     {
  16.         cin.clear();
  17.         cin >> width;
  18.     }
  19.     while (cin.bad() || width < 10 || width > 300);
  20.     int height;
  21.     do
  22.     {
  23.         cin.clear();
  24.         cin >> height;
  25.     }
  26.     while (cin.bad() || height < 10 || height > 500);
  27.     double percent;
  28.     do
  29.     {
  30.     cin.clear(); cin >> percent;
  31.     }
  32.     while (cin.bad() || percent < 0 || percent > 100);
  33.     double capacity = (lenght * width * height) * 0.001;
  34.     double free = (capacity - (capacity * percent / 100));
  35.     cout << fixed << setprecision(3) << free << endl;
  36.     return 0;
  37.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top