Differentiating between invalid format and invalid input

My lab assignment is to convert feet and inches to millimeters. The user will input the measurement with the feet first, and inches second. The user must also input the units and have a comma between 't' and 'i'. Thus, the following inputs are considered valid:

16 feet/ft/ft., 3 inches/in/in.

Part of the assignment, however, is to detect cases of incorrect format and invalid characters. If the user inputted only "3 inches", for example, the input is considered valid, but incorrectly formatted because there is no "feet" measurement.

My thinking is, as I read the unit into my "unit" string, check if the unit is in an array of acceptable unit strings, which have commas. If it is not, then either one (or both) of the following is true:
1) The unit is feet, and the last character is not a comma
2) The unit inputted is not valid.
Can you show us your efforts and what you have tried?
Topic archived. No new replies allowed.