18.7k views
1 vote
1. Menu driven conversion program Write a menu-driven program to convert measurements from miles to kilometers, feet to meters, degrees F to degrees C. Use function subprograms to carry out the necessary conversions. Input: OPTION, MILES, FEET, DEGF Output: Equivalent of MILES in kilometers, of FEET in meters, and of DEGF degrees Fahrenheit in degrees Celsius.

User Dysfunc
by
4.2k points

1 Answer

4 votes

Answer:

See explaination

Step-by-step explanation:

#include<iostream>

#include<stdio.h>

#include<math.h>

using namespace std;

double mile(int);

double ft(int);

double degree(int);

int main()

{

int option;

double res;

cout<<"\\ 1. Convert Miles to Kilometers";

cout<<"\\ 2. Convert Feet to Metres";

cout<<"\\ 3. Convert Degrees F to Degrees C";

cout<<"\\ 4. Exit";

cout<<"\\ Enter Your Option: ";

cin>>option;

switch(option)

{

case 1:

int miles;

cout<<"\\ Convert Miles to Kilometres";

cout<<"\\ Enter Miles to convert to Kilometres: ";

cin>>miles;

res = mile(miles);

cout<<"\\ Equivalent of Miles in Kilometres = " <<res;

break;

case 2:

int feet;

cout<<"\\ Convert Feet to Metres";

cout<<"\\ Enter Feet to convert into Metres: ";

cin>>feet;

res = ft(feet);

cout<<"\\ Equivalent of Feet in Metres = " <<res;

break;

case 3:

int degf;

cout<<"\\ Convert Degrees F to Degrees C";

cout<<"\\ Enter Degree in F to convert into Degree C:";

cin>>degf;

res = degree(degf);

cout<<"\\ Equivalent of Farenheit in Celsius = " <<res;

break;

case 4:

cout<<"Bye Bye!!!";

break;

}

}

double mile(int mi)

{

float mile;

mile = 1.609344 * mi;

return mile;

}

double ft(int fe)

{

float ft;

ft = fe / 3.28;

return ft;

}

double degree(int dg)

{

float degree;

degree = (dg - 32) / 1.8;

return degree;

}

User Lego
by
4.1k points