Steps to make this program work would be great so I can understand it, thank you
ID: 3863473 • Letter: S
Question
Steps to make this program work would be great so I can understand it, thank you.
//Lab 6 kiloConvceter.cpp//This menu-driven program lets the user convert//pounds to kilograms and kilograms to pounds.//TOT YOUR NAME HERE. #include using namespace std;//Function prototypes//WRITE PROTOTYPES FOR THE displayMenu, getChoice, //kilosToPounds end poundsToKilos FUNCTIONS HERE./main ? int main() {//DECLARE ANY VARIABLES MAIN USES HERE.//WRITE THE CODE HERE TO CARRY OUT THE STEPS//REQUIRED 3Y THE PROGRAM SPECIFICATIONS. return 0; ? displayMenu///WRITE THE displayMenu FUNCTION HERE.//THIS void FUNCTION DISPLAYS THE MENU CHOICES//Convert kilograms to pounds//Convert pounds to kilograms//Quit ? getChoice///THIS IS THE SAKE FUNCTION YOU WROTE EARLIER IN THIS SET//OF LAB EXERCISES. JUST FIND IT AND PASTS IT HERE./kiloToPounds///WRITE THE kilosToPounds FUNCTION HERE.//IT RECEIVES A WEIGHT IN KILOS AND MUST CALCULATE//AND RETURN THE EQUIVALENT NUMBER OF POUNDS./poundsToKilos///WRITE THE poundsToKilos FUNCTION HERE.//IT RECEIVES A WEIGHT IN POUNDS AND MUST CALCULATE//AND RETURN THE EQUIVALENT NUM3ER OF KILOS. Sample Run Convert kilograms to pounds Convert pounds to kilograms Quit Weight to be converted: 4 4 kilograms = 8.8 pounds. Convert kilograms to pounds Convert pounds to kilograms Quit Weight to be converted: 10 10 pounds = 4.54545 kilograms. Convert kilograms to pounds Convert pounds to kilograms QuitExplanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double lb,kg;
int pounds;
char option;
cout << "1.Convert Kilograms to Pounds " << " " << "1) " << " " << "2) 2.convert Pounds to Kilograms: "<<"3) " <<"Quit" <<"Enter option 1 or 2 or 3: ";
cin.get(option);
if(option == 1)
{
cout<<"Weigth to be converted :";
//cout<<"Enter weight in Kilograms :"
cin>>kg;
lb = kg*2.2046;
cout << kg << "Kilograms = "<< lb <<"Pounds"<<' ';
}
else if(option == 2){
cout<<"Weigth 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);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.