Cant solve this PLEASE HELP

Write your question here.

Hey guys I really need help writing this code…I don't even know where to start…so if you could please help me I would be very happy!

Prob.:
Write a C++ code that will determine the res. value ( in Ohms or kOhms or MOhms) of a carbon or metal film res.(ranging from 1/8 to 5 watts) when the program user inputs the three colors of the res.'s color band. Your Program should accept the following char. as inputs for the three res. color bands:
BLACK='B' (0 for bands one or two and 10^0 for band three)
BROWN='b' (1 for bands one or two and 10^1 for band three)
RED = 'R' or 'r' (2 for bands one or two and 10^2 for band three)
ORANGE='O' or 'o' (3 for bands one or two and 10^3 for band three)
YELLOW='Y' or 'y' ( 4 for bands one or two and 10^4 for band three)
GREEN='G' (5 for bands one or two and 10^5 for band three)
BLUE='U' or 'u' (6 for bands one or two and 10^6 for band three)
Violet='V'( 7 for bands one or two, not used in band three)
GRAY='g'(8 for bands one or two, not used in band 3)
WHITE='W'(9 for bands one or two,not used for band three)

The program should be able to calc. the res. value after the user enters the char. corresponding to the three colors or res. color bands.
Oh, this is a fun one.

So for starters, go read the tutorial or the documentation on input/output (cin/cout). I'm assuming that the assignment wants you to ask the user for the colors and outputs the result to the screen.

Here are some tips:
- Write a function or a section of code which gets the inputs from the user and parses them. It is unclear from your post whether or not the user has to enter them all at once, or separately, or if you get to choose, but what you want to end up with are three characters, one for each resistor band.

- Write a function to convert the character codes into enumerations. If you don't know how to use enumerations, look up enumerations in C/C++. So now you have an enumeration value for each band.

- Write code to convert from the enumeration value to a resistor value, for each band (since values vary depending on which band is which color).

- Add the results and you have your answer.

Now, I realize that this isn't the most efficient way to figure resistive values, but you can always make the code prettier later.

Hope this helps.
Topic archived. No new replies allowed.