//Process:- This program will calculate the matric value to U.S.. equivalent,
//the program will ask the user to input the matric value and will
convert
//in to U.S. equvalent by using the matric system conversition
formula//
//___________________________________________________________________
#include<iostream.h>
void main()
{
float meter, inches, decameter, feet, hectometer, yard, kilometer, miles, are, squareyard;
float cubicmeter, cubicyard, liter, decaliter, liquidquart, hectoliter, liquidgallon;
float gr
am, ounces, dekagram, hectogram,
kil
ogram, pounds;
cout<<"METRIC SYSTEM CONVERSITION"<<endl<<endl;
cout<<"------------------------------------------"<<endl<<endl;
cout<<"ENTER THE METER TO CONVERT IN INCHES"<<endl;
cin>>meter;
inches = meter * 39.97;
cout<<"Inches is:"<<inches<<endl<<endl;
cout<<"ENTER THE DECAMETER TO CONVERT IN FEET"<<endl;
cin>>decameter;
feet = decameter * 10;
cout<<"Feet is:"<<feet<<endl<<endl;
cout<<"ENTER THE HECTOMETER TO CONVERT IN YARD"<<endl;
cin>>hectometer;
yard = hectometer * 100;
cout<<"YARD IS:"<<yard<<endl<<endl;
cout<<"ENTER THE KILOMETER TO CONVERT IN TO MILES"<<endl;
cin>>kilometer;
miles = kilometer * 0.6214;
cout<<"MILES IS:"<<miles<<endl<<endl;
cout<<"ENTER THE ARE TO CONVERT IN TO SQUARE YARD"<<endl;
cin>>are;
squareyard = are * 119.60;
cout<<"SQUARE YARD IS:"<<squareyard<<endl<<endl;
cout<<"ENTER THE CUBIC METER TO CONVERT IN TO CUBIC YARD"<<endl;
cin>>cubicmeter;
cubicyard = cubicmeter * 1307;
cout<<"CUBIC YARD IS:"<<cubicyard<<endl<<endl;
cout<<"ENTER THE LITER TO CONVERT IN TO LIQUID QUARTS"<<endl;
cin>>liter;
liquid quart = liter * 1.057;
cout<<"LIQUID QUARTS IS:"<<liquidquart<<endl<<endl;
cout<<"ENTER THE DECALITER TO CONVERT IN TO LIQUID QUARTS"<<endl;
cin>>decaliter;
liquidquart = decaliter * 10.570;
cout<<"LIQUID QUARTS IS:"<<liquidquart<<endl<<endl;
cout<<"ENTER THE HECTOLITER TO CONVERT IN TO LIQUID GALLONS"<<endl;
cin>>hectoliter;
liquidgallon = hectoliter * 22;
cout<<"LIQUID GALLONS IS:"<<liquidgallon<<endl<<endl;
cout<<"ENTER THE GRAM TO CONVERT IN TO OUNCES"<<endl;
cin>>gram;
ounces = gram * 0.035;
cout<<"OUNCES IS:"<<ounces<<endl<<endl;
cout<<"ENTER THE DEKAGRAM TO CONVERT IN TO OUNCES"<<endl;
cin>>dekagram;
ounces = dekagram * 0.350;
cout<<"OUNCES IS:"<<ounces<<endl<<endl;
cout<<"ENTER THE HECTOGRAM TO CONVERT IN TO OUNCES"<<endl;
cin>>hectogram;
ounces = hectogram * 3.500;
cout<<"OUNCES IS:"<<ounces<<endl<<endl;
cout<<"ENTER THE KILOGRAM TO CONVERT IN TO POUNDS"<<endl;
cin>>kilogram;
pounds = kilogram * 2.205;
cout<<"POUNDS IS:"<<pounds<<endl<<endl;
}
The other way of doing this problem
//Program Name:- metric conversition
//subject:-CIS 205
//this program will calculate the matric value in to U.S equivalent
by
//using matric conversition formula. This program will not ask the
user to
//input the value to be converted.
#include<iostream.h>
const int deka = 10;
const int hecto = 100;
const int kilo = 1000;
void main()
{
float meter = 39.97;
//one meter = 39.97 inches
//hundred are = 119.6 squreyards
float are = 119.60;
//one cubic meter= 1307 cubicyards
//one liter = 1.057 liquidquarts
float cubic = 1307;
//one grams = 0.035 ounces
float liter = 1.057;
float gram = 0.035;
float dekameter, hectometer, kilometer, dekaliter, hectoliter,dekagram,hectogram,
kilogram;
dekameter = (meter * deka)/12 ; //to convert in to feet
hectometer = (meter * hecto)/36 ; //to convert in to yards
kilometer = 0.6214/1 ; //to convert in to mile
dekaliter = liter * deka; //to convert in to liquidquarts
hectoliter = (liter * hecto) * 0.2642; //to convert in to liquidgallons
dekagram = gram * deka; // to convert in to ounces
hectogram = gram * hecto; //to convert hectogram in to ounces
kilogram = gram * kilo/16;
// to convert kilogram in to pounds
cout<<"\n\t METRIC
SYSTEM CONVERSITION
\n";
cout<<"\n\t METRIC VALUE \t U.S. EQUIVALENT \n";
cout<<"\n\t ***********************************************\n";
cout<<"\n\t Meter \t" <<meter<<"inches";
cout<<"\n\t dekameter \t" <<dekameter<<"feet";
cout<<"\n\t hectometer \t" <<hectometer<<"yards";
cout<<"\n\t kilometer \t" <<kilometer<<"miles";
cout<<"\n\t 100 Are \t" <<are<<"squareyards";
cout<<"\n\t cubicmeter \t" <<cubic<<"cubicyards";
cout<<"\n\t liter \t" <<liter<<"liquidquarts";
cout<<"\n\t dekaliter \t" <<dekaliter<<"liquidquarts";
cout<<"\n\t hectoliter \t" <<hectoliter<<"liquidgallons";
cout<<"\n\t gram \t" <<gram<<"ounces";
cout<<"\n\t dekagrams \t" <<dekagram<<"ounces";
cout<<"\n\t hectogram \t" <<hectogram<<"ounces";
cout<<"\n\t kilogram \t" <<kilogram<<"pounds";
}