#include <iostream>
using namespace std;
int meter_mill (int m)
{
int mill;
mill=m*1000;
return (mill);
}
int meter_cent (int a)
{
int cent;
cent=a*100;
return (cent);
}
double meter_kil (double a )
{
double kil;
kil=a*.001;
return (kil);
}
double meter_inc (double a)
{
double inc;
inc=a*39.37008;
return (inc);
}
double meter_feet (double a)
{
double feet;
feet=a*3.28084;
return (feet);
}
double meter_yard (double a)
{
double yard;
yard=a*1.09361;
return (yard);
}
double meter_mile (double a)
{
double mile;
mile=a*6.2;
return (mile);
}
double meter_naut_mile (double a)
{
double naut_mile;
naut_mile=a*5.4;
return (naut_mile);
}
int main ()
{
char choice;
double mm,cm,km,in,ft,yrd,m,nm;
double n;
cout<<"Choose a Unit of Measurement: \na-Meter-Millimeter \nb-Meter-Centimeter\nc-Meter-Kilometer\nd-Meter-Inches\ne-Meter-Feet\nf-Meter-Yard\nj-Meter-Mile\nk-Meter-Nautical Mile"<<endl;
cin>>choice;
switch (choice)
{
case 'a':
cout<<"Enter Number of Meter: ";
cin>>n;
mm = meter_mill (n);
cout << "The height in milimeter is "<<mm<<endl;
break;
case 'b':
cout<<"Enter Number of Meter: ";
cin>>n;
cm = meter_cent (n);
cout << "The height in centimeter is "<<cm<<endl;
break;
case 'c':
cout<<"Enter Number of Meter: ";
cin>>n;
km = meter_kil (n);
cout << "The height in Kilometer is "<<km<<endl;
break;
case 'd':
cout<<"Enter Number of Meter: ";
cin>>n;
in = meter_inc (n);
cout << "The height in Inches is "<<in<<endl;
break;
case 'e':
cout<<"Enter Number of Meter: ";
cin>>n;
ft = meter_feet (n);
cout << "The height in Feet is "<<ft<<endl;
break;
case 'f':
cout<<"Enter Number of Meter: ";
cin>>n;
yrd = meter_yard (n);
cout << "The height in Yard is "<<yrd<<endl;
break;
case 'j':
cout<<"Enter Number of Meter: ";
cin>>n;
m = meter_mile (n);
cout << "The height in Miles is "<<m<<endl;
break;
case 'k':
cout<<"Enter Number of Meter: ";
cin>>n;
nm = meter_naut_mile (n);
cout << "The height in Nautical Miles is "<<nm<<endl;
break;
default:
cout<<"Out of coverage"<<endl;
}
return 0;
}
No comments:
Post a Comment