The resistance of a resistor is given by colored bands. The colors correspond to integer codes as given in the following table:
|
|
Write a function menu() that displays a menu of colors, prompts user to enter a color (e.g., B for black, N for brown, R for red, etc.), and returns the chosen character. Note that a few of the colors start with the same letter.
Write a function decode__char(), with a parameter to receive a color, that converts the color to corresponding numeric code and returns the code.
Write a function calc_ohms(), that takes the three code values and returns the result of the ohms calculations.
All other computation is done in main(). The functions should check for obvious error states. Things like unknown colors should result in an error message.You should turn in a listing of the program.
Think about how you will do this so you can ask questions.
ASK if you have any questions.