Progam Help

How write a program that will determine the resistance value (in Ohms or kOhms)of a carbon or metal film resistor (ranging from 1/8 to 5 watts) when the program user inputs the three colors of the resistors color band. Your program should accept the following charactes as string variable inputs for the three resistor color bands.


Black = 'B'
Brown='b'
RED='R' or 'r'
orange ='O' or 'o'follows pattern above
Yellow= Y or y(4 for bands one or two and pow(10,4) for band three
Green 'G'(5 for bands one or two and pow(10,5) for band three
blue='U' (6 for bands one or two and pow(10,6) for band three

Violet = 'V' (7 for bands one and two and not used in band three because color cod only include resistors less than 100 Mohms)
Gray='g' (8 for bands one and two and not included in band three)
White='W' or 'w' (9 for bands one or two and not used in band three)

I'm trying to used switch case or else/if to solve this problem.



Do you mind telling us what the resistance for each individual band is and how to manually calculate the overall resistance?
black =pow(10,0)
brown=pow(10,1)
red=pow(10,2)
the pattern continues all the way to white by increasing it by one.
for example if the user entered 'O' and 'r' and 'b' then the corresponding resistor value to print out would be 32* pow (10,0) or 32 ohms. if the user entered 'b','y' and 'G' then the corresponding resistor value would be 14 * pow (10,5) or 1400000

I'm not 100% sure how to calculate the overall resistance but hopefully this will help
A C++ program that determines exactly how many hours have passed since a previous historical event happened. for example if the user enterd the hour and date of the historical event (including the time of day in military format, the month in string format, the day of the month in integer format and year in 4 digit format) then your program would calculate the number of hours between then and the present time. Note you should take into account the extra days due to leap years and the numbers of days in a month.

for example if the user entered 1400 hours for the hour , July for the month, 4 for the day and 1776 for the year, your program would calculate and return the number of hours that have passed since the declaration of independence.

Hint: looking up the Gregorian calendar and leap years on Wikipedia can give some useful information on taking leap years into account

I also need help with this problem if the first one is not clear.
Topic archived. No new replies allowed.