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.I have written a solution to this and it is available here. You should be able to just download and run this to see an example of what the the results should look like.
You should turn in a listing of the program. Staple the cover sheet to that.
Think about how you will do this so you can ask questions.
ASK if you have any questions.