So I'm suggesting that you want to display a menu, perhaps like this:
0. Convert "cm" to "in"
1. Convert "in" to "ft"
Enter the number of the conversion you'd like:
To make the above menu, you could write this loop:
1 2 3
|
for( int i = 0; i < 2; i++ )
cout << i << ". Convert " << conversions[i].from << " to "
<< conversion[i].to << endl;
|
When the user enters, for example 1, you know they want to
convert "in" to "ft". Ask them to enter the number of "in".
Again, you get the word "in" by looking at conversions[choice].from,
where choice is the variable holding the number of the option the
user chose.
After they type in the number of inches, say 18, you take 18,
multiply it by conversions[choice].conv_factor, and output the
result. The units of the result are conversions[choice].to.