Question: #include #include using namespace std; int main() { double lb,kg; int pounds; char option; cout < < 1. Convert Kilograms to Pounds: < <
#include
#include
using namespace std;
int main()
{
double lb,kg;
int pounds;
char option;
cout << "1. Convert Kilograms to Pounds: "
<< "2. Convert Pounds to Kilograms: "
<< "3. Quit ";
cin.get(option);
if(option == 1)
{
cout<<"Weight to be converted :";
//cout<<"Enter weight in Kilograms :"
cin>>kg;
lb = kg*2.2046;
cout << kg << "Kilograms ="<< lb <<"Pounds"<<' ';
}
else if(option == 2)
{
cout<<"Weight to be converted :";
//cout<<"Enter weight in Pounds :"
cin>>lb;
kg = lb/2.2046;
cout << lb << "Pounds = "<< lb <<"Kilograms"<<' ';
}
else if(option == 3)
{
exit(0);
}
}
CAN I GET HELPED WITH THIS INSTEAD, SORRY ABOUT THE PREVIOUS QUESTION.
FOR THIS PROGRAM I SEEM TO NOT UNDERSTAND WHY THE SELECTION OF AN OPTION DOES NOT EXECUTE ITS RESULT?
It should come out like this---
Sample Run
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
1
Weight to be converted: 4
4 kilograms = 8.8 pounds.
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
2
Weight to be converted: 10
10 pounds = 4.54545 kilograms.
1. Convert kilograms to pounds
2. Convert pounds to kilograms
3. Quit
3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
