Question: Complete the following program to implement the user interface of the preceding exercise (above). For simplicity, only the units cm, m, and in are supported.

 Complete the following program to implement the user interface of the

Complete the following program to implement the user interface of the preceding exercise (above). For simplicity, only the units cm, m, and in are supported. Pleas stay in this format only.

#include  #include  using namespace std; int main() { bool done = false; string unit1 = ""; string unit2 = ""; double factor1 = 0; // conversion factor from first unit to cm double factor2 = 0; // conversion factor from cm to second unit while (!done) { bool again = false; // true to repeat the same conversion cout > command; if (command == "in") { factor1 = 2.54; unit1 = command; } else if (command == "cm") { . . . } else if (command == "m") { . . . } else if (command == "again") { again = true; } else if (command == "quit") { done = true; } else { cout > unit2; if (unit2 == "in") { factor2 = 1.0 / 2.54; } else if (unit2 == "m") { . . . } else if (. . .) { } else { cout > value; // Convert and print result cout 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!