Assignment 2: Length Conversions

We have the following goal: we need a program that can convert lengths from one scale to any other scale. Specifically, we want to be able to enter a length in any of the scales "cm", "inches", "feet", "meter", or "km", and know the resulting length in any of the other scales.

For example:

 1 inch = 2.54 cm 1 feet = 12 inches 1 meter = 3.28 feet 1 km = 1,000 m 1 km = 100,000 m 1 feet = 30.48 cm

and so forth.

Last time, we already came up with an outline for this program. We determined that we need a variety of conversion functions from one unit to another unit, and that our main program could look similar to this one:

```
int main(void)
{
double number = getNumber();{
char scale = getScale();{
number = NumberToCm(number, scale);
cout << "\t Cm: \t" << number << endl; number="CmToInches(number);" cout << "\t Inch:\t" << number << endl; number="InchesToFeet(number);" cout << "\t Feet:\t"<< number << endl; number="FeetToMeter(number);" cout << "\t Meter:\t" << number << endl; number="MeterToKm(number);" cout << "\t Km: \t" << number << endl; return 0; } ```
where
 double getNumber(void) is a function that asks the user to enter a number, and returns that number char getScale(void) is a function that asks the user to enter a scale, and returns it as a character double NumberToCm(double, char) is a function that converts a number in a given scale into centimeters double CmToInches(double) and the remaining functions convert the input number to the indicated scale, assuming that the input number has the correct scale already.

```To assist you in creating this program, you can download a file that will
contain all the necessary conversion formulas as "C++" functions already.
You still need to implement, however, the functions NumberToCm,
getNumber, and getScale.

```
 After clicking on the next link, save that file to your network account drive Z:. You must be logged in to the MathSci network for this to work. You can find the "Save As" command under the "File" menu of netscape. Click here to look at and then save the conversion formulas Click here for instructions on how to use the file you have just saved in the previous step.

```(bgw)
```