Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include<iomanip>
- using namespace std;
- int main()
- {
- long volume_in_liters;
- long debit_first_pipe;
- long debit_second_pipe;
- float hours;
- cin >> volume_in_liters >> debit_first_pipe >> debit_second_pipe >> hours;
- long percent = ((debit_first_pipe * hours + debit_second_pipe * hours) / volume_in_liters) * 100;
- long percents_first_pipe = ((debit_first_pipe * hours) / (debit_first_pipe * hours + debit_second_pipe * hours)) * 100;
- long percents_second_pipe = ((debit_second_pipe * hours) / (debit_first_pipe * hours + debit_second_pipe * hours)) * 100;
- double capacity = debit_first_pipe * hours + debit_second_pipe * hours;
- if (capacity <= volume_in_liters)
- {
- cout << "The pool is " << percent << "% " << "full. " << "Pipe 1:" << " " << percents_first_pipe << "%." << " " << "Pipe 2:" << " " << percents_second_pipe << "%." << endl;
- }
- else if (capacity > volume_in_liters)
- {
- cout << "For " << hours << " " << "hours the pool overflows with " << fixed << setprecision(1) << capacity - volume_in_liters << " " << "liters." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement