A fixed percentage of water is taken out from a tank each day. Write a program, Tank.cpp, that
accepts as input:
W, representing the amount of water in the tank at the start of the first day
P, representing the fixed percentage of water taken out of the tank each day
and, starting from the first day, displays the number of the day, the amount of water taken out for
that day, and the amount of water remaining in the tank at the end of that day. Your program should
terminate after 30 days have been displayed or when the amount of water remaining is less than
100 units, whichever comes first.
1
Expert's answer
2019-10-21T15:31:39-0400
void Tank(double W, double P)
{
int i =1;
do
{
cout << "Number day: "<< i++ <<". Water taken: " << W*P/100 << ". Water remaining: "<< W*(100-P)/100 << endl;
W*=(100-P)/100;
} while (W >=100 && i <31);
}
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment