startMiner - free and simple next generation Bitcoin mining software

Program that convert 'Inches to Centimeter Mile to Kilometer Pound to Kilogram

This example program is taken from the book C++ IT series chapter.no 5,program.no 8
Write aprogram that input a value and type of coversion,Program should include the following conversions:

  1. Inches = 2.54 Centimeter
  2. Gallon = 3.785 Liters
  3. mile = 1.609 kilometers
  4. pound = 0.4536 kilograms




using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
    char conversion;
float value,result;
cout<<"Enter 'I' for inches to centimeters\n";
cout<<"Enter 'G' for gallon to leters\n";
cout<<"Enter 'M' for miles to kilometer\n";
cout<<"Enter 'P' for pound to kilogram"<<endl;
cout<<"Enter a Conversion:";
cin>>conversion;

  switch(conversion)
  {
  case 'I':
  case 'i':
  {
cout<<"Enter Inches:";
  cin>>value;
  result=value*2.54;
  cout<<value<<" inches ="<<result<<" centimeters";
   }
break;
case 'G':
  case 'g':
  {
cout<<"Enter Gallon:";
  cin>>value;
  result=value*3.785;
  cout<<value<<" gallons ="<<result<<" liters";
   }
break;
case 'M':
  case 'm':
  {
cout<<"Enter Miles:";
  cin>>value;
  result=value*1.609;
  cout<<value<<" miles ="<<result<<" kilometers";
   }
break;
case 'P':
  case 'p':
  {
cout<<"Enter Pound:";
  cin>>value;
  result=value*0.4536;
  cout<<value<<" pound ="<<result<<" kilograms";
   }
break;
default:
cout<<"Invalid Input";

Result /Output

getch();      
return 0;
}

Program idea:
we can also make program that tells:

  • lbs to kg
  • pounds to kgs conversion rate
  • converter kg to pounds
Program that convert 'Inches to Centimeter Mile to Kilometer Pound to Kilogram Program that convert 'Inches to Centimeter Mile to Kilometer Pound to Kilogram Reviewed by Alpha on 3/08/2017 05:24:00 pm Rating: 5

1 comment:

  1. They're produced by the very best degree developers who will be distinguished for your polo dress creating. You'll find polo Ron Lauren inside exclusive array which include particular classes for men, women. Convert pounds to kg

    ReplyDelete

Theme images by mariusFM77. Powered by Blogger.