Question: Write a C + + program that will use a function called ConvertWeight that accepts a real Value and two characters InUnits and OutUnits and

Write a C++ program that will use a function called ConvertWeight that accepts a real Value and two characters InUnits and OutUnits and then converts Value given in InUnits to the equivalent value in OutUnits and display this value. Inputs must be read from a file called data.txt. Output must be displayed at the console screen . The following is the conversions chart:
InUnits or OutUnits Symbol
Conversion
P (for pints)
pints to liters: 1pt =0.473167 L
L (for liters)
Q (for quarts)
quarts to liters: 1qt =0.94633 L
G (for gallons)
gallons to liters: 1 gal =3.78541 L
Make sure:
(i) Include comments in the program.
(ii) Program descriptions should be displayed at the beginning of the program.
(iii) Variables type should be chosen according to the programs input data.
(iv) Result should be displayed with three decimal place accuracy.
(v) Include a test run of your choice.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!