Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- using namespace std;
- int V, P1, P2;
- double H;
- cin >> V >> P1 >> P2 >> H;
- double V1 = P1 * H,
- V2 = P2 * H;
- if (V1 + V2 <= V)
- {
- int x = (int)((V1 + V2) * 100.0 / V),
- y = (int)(V1 * 100.0 / (V1 + V2)),
- z = (int)(V2 * 100.0 / (V1 + V2));
- cout << "The pool is " << x << "% full. Pipe 1: " << y << "%. Pipe 2: " << z << "%." << endl;
- }
- else
- {
- cout << "For " << H << " hours the pool overflows with ";
- cout.precision(1);
- cout << fixed << V1 + V2 - V << " liters." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement