Keeping track of and converting between US fluid quantities can be quite confusing and challenging, given all those tablespoons, ounces, quarts, etc. The relationships between all of these fluid units are:
Write a program that asks the user to input a number of fluid ounces. Allocate the fluid ounces into the various units, first starting with barrels, then gallons, and so on, finishing with tablespoons.
Sample 1:
How many fluid ounces do you have? 77
77 fluid ounces can be divided into:
0 barrel(s)
0 gallon(s)
2 quart(s)
0 pint(s)
1 cup(s)
1 gill(s)
2 tablespoons
Sample 2:
How many fluid ounces do you have? 6555
6555 fluid ounces can be divided into:
1 barrel(s)
9 gallon(s)
0 quart(s)
1 pint(s)
1 cup(s)
0 gill(s)
6 tablespoons
const int fluid_ounce_to_tablespoons = 2; const int gill_to_fluid_ounces = 4; const int cup_to_gills = 2; const int pint_to_cups = 2; const int quart_to_pints = 2; const int gallon_to_quarts = 4; const int barrel_to_gallons = 42; int tablespoon, ounce, gill, cup, pint, quart, gallon, barrel;
int barrel_to_ounces = barrel_to_gallons* gallon_to_quarts*quart_to_pints* pint_to_cups*cup_to_gills*gill_to_fluid_ounces; int gallon_to_ounces = gallon_to_quarts*quart_to_pints* pint_to_cups*cup_to_gills*gill_to_fluid_ounces; int quart_to_ounces = quart_to_pints*pint_to_cups* cup_to_gills*gill_to_fluid_ounces; int pint_to_ounces = pint_to_cups*cup_to_gills*gill_to_fluid_ounces; int cup_to_ounces = cup_to_gills*gill_to_fluid_ounces;
//input ounces cout << "\nHow many fluid ounces do you have? "; cin >> ounce;
cout << endl << ounce << " fluid ounces can be divided into:\n";
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