Here is source code. To get .cpp file inbox me at ucet.mtn@gmail.com
#include<iostream.h>#include<conio.h>
struct input { int a; double b; };
void dot()
{ for(int y=1;y<40;y++) cout<<"."; }
void star()
{ for(int a=1;a<40;a++) cout<<"*"; }
void line() { for(int x=1;x<50;x++) cout<<"-"; }
void main()
{
clrscr();
star();
cout<<"\n WELCOME TO UNIT CONVERSIONS \n";
star();
cout<<endl<<" \n";
line();
cout<<"\nPress the number mentioned against the conversions that you want to carry out\n";
cout<<" \n";
line();
cout<<"\n1. Weight Conversions\n2. Length Conversions\n3. Temperature Conversions : ";
input x;
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
{
cout<<"1. Kilogram to other units\n2. Pound to others\n3. Ounce to Others\n4. Grams to others\n5. Miligrams to Others\n6. Grains to others : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"1. Kilogram to Pound Conversions\n2. Kilogram to Ounce\n3. Kilogram to gram \n4. Kilogram to Miligram\n5. Kilograme to Grains : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter weight in Kg :"; cin>>x.b;
cout<<"weight in Pound is :"<<(x.b*2.20462)<<endl;
break;
case 2:
cout<<"Enter weight in Kg :"; cin>>x.b;
cout<<"Weight in ounce is :"<<(x.b*35.273)<<endl;
break;
case 3:
cout<<"Enter weight in Kg :"; cin>>x.b;
cout<<"Weight in Gram is :"<<(x.b*1000)<<endl;
break;
case 4:
cout<<"Enter Weight in Kg :"; cin>>x.b;
cout<<"Weight in Miligram is :"<<(x.b*1000000)<<endl;
break;
case 5:
cout<<"Enter weight in Kg :"; cin>>x.b;
cout<<"Weight in Grains is :"<<(x.b*15432)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 2:
cout<<"1. Pound to Kilogram\n2. Pound to Ounce \n3. Pound to Gram\n4. Pound to Miligram\n5. Pound to Grain : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"Enter weight in Pound :"; cin>>x.b;
cout<<"Weight in Kg is : "<<(x.b*0.45359)<<endl;
break;
case 2:
cout<<"Enter weight in Pound :"; cin>>x.b;
cout<<"Weight in Ounce is :"<<(x.b*16)<<endl;
break;
case 3:
cout<<"Enter weight in Pound :"; cin>>x.b;
cout<<"Weight in Gram is : "<<(x.b*453.59)<<endl;
break;
case 4:
cout<<"Enter weight in Pound :"; cin>>x.b;
cout<<"Weight in Miligram is :"<<(x.b*453592)<<endl;
break;
case 5:
cout<<"Enter weight in Pound :"; cin>>x.b;
cout<<"Weight in Grain is :"<<(x.b*7000)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 3:
cout<<"1. Ounce to Kilogram\n2. Ounce to Pound\n3. Ounce to Gram\n4. Ounce to Miligram\n5. Ounce to Grain : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"Enter weight in Ounce :"; cin>>x.b;
cout<<"Weight in Kg is :"<<(x.b*0.028349)<<endl;
break;
case 2:
cout<<"Enter weight in Ounce :"; cin>>x.b;
cout<<"Weight in Pound is :"<<(x.b*0.0625)<<endl;
break;
case 3:
cout<<"Enter weight in Ounce :"; cin>>x.b;
cout<<"Weight in Gram is :"<<(x.b*28.349)<<endl;
break;
case 4:
cout<<"Enter weight in Ounce :"; cin>>x.b;
cout<<"Weight in Miligram is :"<<(x.b*28349)<<endl;
break;
case 5:
cout<<"Enter weight in Ounce :"; cin>>x.b;
cout<<"Weight in Grains is :"<<(x.b*437.5)<<endl;
break;
default: cout<<"Wrong Selection Try again";
}
break;
case 4:
cout<<"1. Gram to Kg\n2. Gram to Pound\n3. Gram to Ounce\n4. Gram to Miligram\n5. Gram to Grain : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"Enter weight in Gram :"; cin>>x.b;
cout<<"Weight in Kg is :"<<(x.b*0.001)<<endl;
break;
case 2:
cout<<"Enter weight in Gram :"; cin>>x.b;
cout<<"Weight in Pound is :"<<(x.b*0.0022)<<endl;
break;
case 3:
cout<<"Enter weight in Gram :"; cin>>x.b;
cout<<"Weight in Ounce is :"<<(x.b*0.03527)<<endl;
break;
case 4:
cout<<"Enter weight in Gram :"; cin>>x.b;
cout<<"Weight in Miligram is :"<<(x.b*1000)<<endl;
break;
case 5:
cout<<"Enter weight in Gram :"; cin>>x.b;
cout<<"Weight in Grains is :"<<(x.b*15.432)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 5:
cout<<"1. Miligrame to Kg\n2. Miligram to Pound\n3. Miligram to Ounce\n4. Miligram to Gram\n5. Miligram to Grain : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"Enter weight in Miligram :"; cin>>x.b;
cout<<"Weight in Kg is :"<<(x.b*0.000001)<<endl;
break;
case 2:
cout<<"Enter weight in Miligram :"; cin>>x.b;
cout<<"Weight in Pound is :"<<(x.b*0.0000022)<<endl;
break;
case 3:
cout<<"Enter weight in Miligram :"; cin>>x.b;
cout<<"Weight in Ounce is : "<<(x.b*0.00003527)<<endl;
break;
case 4:
cout<<"Enter weight in Miligram :"; cin>>x.b;
cout<<"Weight in gram is :"<<(x.b*0.001)<<endl;
break;
case 5:
cout<<"Enter weight in Miligram :"; cin>>x.b;
cout<<"Weight in Grains is :"<<(x.b*0.15432)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 6:
cout<<"1. Grain to Kilogram\n2. Grain to Pound\n3. Grain to Ounce\n4. Grain to Gram\n5. Grains to Miligram : ";
cin>>x.a;
dot(); cout<<endl;
switch(x.a)
{
case 1:
cout<<"Enter weight in Grain :"; cin>>x.b;
cout<<"Weight in Kg is :"<<(x.b*0.001)<<endl;
break;
case 2:
cout<<"Enter weight in Grain :"; cin>>x.b;
cout<<"Weight in Pound is :"<<(x.b*0.0022)<<endl;
break;
case 3:
cout<<"Enter weight in Grain :"; cin>>x.b;
cout<<"Weight in Ounce is :"<<(x.b*0.03527)<<endl;
break;
case 4:
cout<<"Enter weight in Grain :"; cin>>x.b;
cout<<"Weight in Gram is :"<<(x.b*1000)<<endl;
break;
case 5:
cout<<"Enter weight in Grain :"; cin>>x.b;
cout<<"Weight in Miligram is :"<<(x.b*15.432)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
default: cout<<"Wrong Selection Try Again ";
}
}
break;
case 2:
cout<<"Please Enter The Respective Number : ";
cout<<"1. Centimeter To Others\n2. Feet To Others\n3. Inches To Others\n4. Kilometer To Others\n5. Meter To Others\n6. Yard To Others : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"1. Centimeter To Feet\n2. Centimeter To Inches\n3. Centimeter To Kilometer\n4. Centimeter To Milimeter\n5. Centimeter To Meter\n6. Centimeter To Yard : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*0.03280)<<endl;
break;
case 2:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Inches Is : "<<(x.b*0.3837)<<endl;
break;
case 3:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.00001)<<endl;
break;
case 4:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*0.10)<<endl;
break;
case 5:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*0.01)<<endl;
break;
case 6:
cout<<"Enter in Cm : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*0.01093)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 2:
cout<<"1. Feet To Cm\n2. Feet To Dm\n3. Feet To Inches\n4. Feet To Km\n5. Feet To Meter\n6. Feet To Yards : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*30.48)<<endl;
break;
case 2:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*3.04799)<<endl;
break;
case 3:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In inches Is : "<<(x.b*12)<<endl;
break;
case 4:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.0003048)<<endl;
break;
case 5:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*304.8)<<endl;
break;
case 6:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*0.3048)<<endl;
break;
case 7:
cout<<"Enter in Feet : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*0.333)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 3:
cout<<"1. Inches To Cm\n2. Inches To dm\n3. Inches To Feet\n4. Inches To Km\n5. Inches to Milimeter\n6. Inches To Meter\n7. Inches To Yards : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*2.54)<<endl;
break;
case 2:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*0.254)<<endl;
break;
case 3:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*0.08334)<<endl;
break;
case 4:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.0000254)<<endl;
break;
case 5:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*25.4)<<endl;
break;
case 6:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*0.0254)<<endl;
break;
case 7:
cout<<"Enter in Inches : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*0.027)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 4:
cout<<"1. Kilometer To Cm\n2. Kilometer To dm\n3. Kilometer To Feet\n4. Kilometer To Inches\n5. Kilometer to Milimeter\n6. Kilometer To Meter\n7. Kilometer To Yards : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*100000)<<endl;
break;
case 2:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*10000)<<endl;
break;
case 3:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*3280.839)<<endl;
break;
case 4:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Inches Is : "<<(x.b*39370.07)<<endl;
break;
case 5:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*1000000)<<endl;
break;
case 6:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*1000)<<endl;
break;
case 7:
cout<<"Enter in Km : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*1093.61)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 5:
cout<<"1. Milimeter To Cm\n2. Milimeter To dm\n3. Milimeter To Feet\n4. Milimeter To Inches\n5. Milimeter to Kilometer\n6. Milimeter To Meter\n7. Milimeter To Yards : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*0.1)<<endl;
break;
case 2:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*0.01)<<endl;
break;
case 3:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*0.00328)<<endl;
break;
case 4:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Inches Is : "<<(x.b*0.039370)<<endl;
break;
case 5:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.000001)<<endl;
break;
case 6:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*0.001)<<endl;
break;
case 7:
cout<<"Enter in mm : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*0.00109)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 6:
cout<<"1. Meter To Cm\n2. Meter To dm\n3. Meter To Feet\n4. Meter To Inches\n5. Meter to Kilometer\n6. Meter To MiliMeter\n7. Meter To Yards : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*100)<<endl;
break;
case 2:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*10)<<endl;
break;
case 3:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*3.280839)<<endl;
break;
case 4:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Inches Is : "<<(x.b*39.37007)<<endl;
break;
case 5:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.001)<<endl;
break;
case 6:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*1000)<<endl;
break;
case 7:
cout<<"Enter in m : "; cin>>x.b;
cout<<"In Yard Is : "<<(x.b*1.09361)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 7:
cout<<"1. Yard To Cm\n2. Yard To dm\n3. Yard To Feet\n4. Yard To Inches\n5. Yard to Kilometer\n6. Yard To MiliMeter\n7. Yard To Meters : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Cm Is : "<<(x.b*91.439)<<endl;
break;
case 2:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In dm Is : "<<(x.b*9.1439)<<endl;
break;
case 3:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Feet Is : "<<(x.b*3)<<endl;
break;
case 4:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Inches Is : "<<(x.b*35.99)<<endl;
break;
case 5:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Kilometer Is : "<<(x.b*0.00091)<<endl;
break;
case 6:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Milimeter Is : "<<(x.b*914.39)<<endl;
break;
case 7:
cout<<"Enter in Yards : "; cin>>x.b;
cout<<"In Meter Is : "<<(x.b*0.091439)<<endl;
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
default: cout<<"Wrong Selection Try Again ";
}
break;
case 3:
cout<<"1. Centigrade To Fahrenheit\n2. Centigrade To Kelvin\n3. Fahrenheit To Centifrade\n4. Fahrenheit To Kelvin\n5. Kelvin To Centigrade\n6. Kelvin To Fahrenheit : ";
cin>>x.a;
switch(x.a)
{
case 1:
cout<<"Enter in Centigrade : "; cin>>x.b;
cout<<"In Fahrehheit Is : "<<((x.b*1.8)+32)<<endl;
break;
case 2:
cout<<"Enter in Centigrade : "; cin>>x.b;
cout<<"In Kelvin is : "<<(x.b+273.16)<<endl;
break;
case 3:
cout<<"Enter in Fahrenheit : "; cin>>x.b;
cout<<"In Centigrade is : "<<((x.b-32)/1.8)<<endl;
break;
case 4:
cout<<"Enter in Fahrenheit : "; cin>>x.b;
cout<<"In Kelvin Is : "<<(((x.b-32)/1.8)+273.16)<<endl;
break;
case 5:
cout<<"Enter in Kalvin : "; cin>>x.b;
cout<<"In Centigrade is : "<<(x.b-273.16)<<endl;
break;
case 6:
cout<<"Enter in Kelvin : "; cin>>x.b;
cout<<""<<(((x.b-273.16)*1.8)+32)<<endl;
break;
default: cout<<"Wrong Selection Try Again";
}
break;
default: cout<<"Wrong Selection Try Again";
}
}
No comments:
Post a Comment