Resistor???

I want to make a program that will solve the value of the resistor.?
The user will input the three color indicated in the resistor and the program will solve for the value of it., Can anybody help me...???
1
2
3
4
5
6
7
8
9
10
11
12
13
int numb;
string color;
cin >> color;
switch (string color)
{
    case "/*color*/":
        numb = /*value*/;
        break;

    case "/*other color*/":
        numb = /*other value*/;
        break;
}


Or something like that. I'm just giving a hint here.
Last edited on
To fill in the hint given above, first write all the possibilities for color1, those are the cases. Do the same for color2 and color3. You then need to put the answer together, combine the pieces, using the same method you do when you figure out the resistor by hand.

Aren't there 4 (and sometimes 5) stripes on a resistor?
@turbozedd
There are typically 4 stripes on a resistor: 2 significant digits, 1 multiplier, and 1 tolerance indicator. Sometimes there are 5 stripes, but those are generally high-precision components. The extra stripe can represent an extra significant digit or temperature drift of the component. So, on a standard component, the ideal value can be determined using only the first three stripes.
Topic archived. No new replies allowed.