#include using namespace std; int main() { constexpr double cm_per_inch = 2.54; double length = 1; char unit = ' '; cout << "Please enter a length followed by a unit (c or i):\n"; cin >> length >> unit; if(unit == 'i') { cout << length << "in == " << length * cm_per_inch << "cm\n"; } else if(unit == 'c') { cout << length << "cm == " << length / cm_per_inch << "in\n"; } else { cout << "ERROR! " << unit << " is not a valid unit. Use i for inches or c for centimeters.\n"; } }