Let’s assume that someone needs to quickly calculate some conversions of units of measurement and print out a chart
We need to convert:
Feet to inches
Yards to inches
Meters to centimeters
Kilometers to decameters
Gallons to pints
Pounds to ounces
You will ask six different questions for the person to enter each of the units.
Have a prompt (state the question asking for input of some number.. use cout… followed by the input using the cin statement)
cout<<”Please enter the amount of
feet.”;
cin>> feet;
inch=feet*12;
After all six questions and cin statements, calculate the values for inches, centimeters, decameters, pints and ounces.
Use these identifiers {feet, inchf, inchy, yard, meter cent, kilo, deca, gallon, pint, pounds, and ounce}. All will be int’s except meter and centimeter (use float for these two). Notice we have two inches, one is for feet (inchf) and one is for yards (inchy).
Have a title, see below that is defined before void main.
#include <iostream.h>
#define TITLE “Measurement conversion
table”
void main( )
{
cout<<TITLE;
After all of this is done, print out the results exactly
like the one below. Have the heading of the chart set in a #define. (Don’t
worry about spacing of the 2nd column)
Measurement Conversion Table
(input
value)……………..(converted value)
Feet:8 Inches: 96
Yards:5 Inches: 180
Meters: 2.5 Centimeters: 250
Kilometers: 4 Decameters: 400
Gallons: 7 Pints: 56
Pounds: 25 Ounces: 400