My question is why is my program running blank when I go to run it.
Create a menu-driven application that supports the followingmenu options A. Miles to Kilometers, B. Kilometers to Miles, Q. Quit. Theprogram should continue to process conversions until Quit is selected. The overall designof your program is up to you. Your program should implement and use the following functions
double milesToKilometers(double miles); takes miles and returns kilometersdouble kilometersToMiles(double kilometers); takes kilometers and returns miles
char getMenuChoice();
getMenuChoice should display the required menu and prompt the user tomake a choice. The function should return choice as type char. Validationis optional.
Your main function should contain the menu switch (i.e. switch should not be in yourgetMenuChoice function). Also, your milesToKilometers, and kilometersToMilesfunctions should NOT contain any cin or cout statements. These functions are strictlycalculation functions (i.e. a single value is passed to the function, and a single value isreturned).
#include using namespace std; char getMenuChoice(); double convertMilestoKilometers(double miles); // function miles to kilometers double convertKilometerstoMiles(double kilo); // function kilo to miles int main() { char getMenuChoice(); int choice; double number; while (true) { cin >> choice; switch (choice) { case 'A': cout << "Miles to be converted: "; cin >> number; cout << number << " Miles = " << convertMilestoKilometers(number) << " kilometers " << endl; break; case 'B':cout << "kilometers to be converted: "; cin >> number; cout << number << " Kilometers = " << convertKilometerstoMiles(number) << " miles " << endl; break; case 'Q': return 0; } } } char getMenuChoice() { int choice; cout << " Menu Driven Conversion Calculator " << endl; // name of the program cout << "---------------------------" << endl; // menu design cout << "A. Convert miles to kilometers" << endl; cout << "B. Convert kilometers to miles" << endl; cout << "Q. Quit " << endl; cout << "------------------------" << endl; cout << "Make a choice" << endl; cin >> choice; return choice; }
double convertMilestoKilometers(double miles) { return miles*1.6093; } double convertKilometerstoMiles(double kilo) { return kilo*.6214; }
Create a menu-driven application that supports the followingmenu options A. Miles to Kilometers, B. Kilometers to Miles, Q. Quit. Theprogram should continue to process conversions until Quit is selected. The overall designof your program is up to you. Your program should implement and use the following functions
double milesToKilometers(double miles); takes miles and returns kilometersdouble kilometersToMiles(double kilometers); takes kilometers and returns miles
char getMenuChoice();
getMenuChoice should display the required menu and prompt the user tomake a choice. The function should return choice as type char. Validationis optional.
Your main function should contain the menu switch (i.e. switch should not be in yourgetMenuChoice function). Also, your milesToKilometers, and kilometersToMilesfunctions should NOT contain any cin or cout statements. These functions are strictlycalculation functions (i.e. a single value is passed to the function, and a single value isreturned).