Create a function convertlength receives a real value


Discuss the below:

Q: Write a function convertLength() that receives a real value and two strings inUnits and outUnits, then converts the value given in inUnits to the equivalent metric value in outUnits and displays this value. The function should carry out the following conversions:

inUnits outUnits

I c (inches to centimeters; 1 in. = 2.54001 cm)
F c (feet to centimeters; 1 ft = 30.4801cm)
F m (feet to meters; 1 ft = 0.304801 m)
Y m (yards to meters; 1 yd = 0.914402 m)
M k (miles to kilometers; 1 mi = 1.60935 km)

Also write a driver program to test your function. What happens if you enter units other than those listed?

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a function convertlength receives a real value
Reference No:- TGS01936430

Now Priced at $20 (50% Discount)

Recommended (98%)

Rated (4.3/5)