Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double volume, pipe1, pipe2, hours;
- cin >> volume >> pipe1 >> pipe2 >> hours;
- double poolV = (pipe1 + pipe2) * hours;
- double poolP = poolV / volume;
- cout.setf(ios::fixed);
- cout.precision(2);
- if (volume >= poolV) {
- cout << "The pool is " << poolP * 100 << "% full.Pipe 1: " << pipe1 / poolV * hours * 100 << "% .Pipe 2: " << pipe2 / poolV * hours << "% .\n";
- }
- else {
- cout << "For " << hours << " hours the pool overflows with " << poolV - volume << " liters.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement