


Type the coloues in lowercase letters only, NO CAPS. Sepnumber (resistor_value_string, resistor_value) ĭo you want to decode anothe resistor (Y/N)?Įnter the colours of the resistor's three bands,īeginning with the band nearest to the end. Resistor_value *= multiplier // Calculate final value Mult = srchItems (answer) // get multiplier index Printf("Do you want to decode anothe resistor (Y/N)?\n") Resistor_value = (resistor_value * 10) + r

Scanf(" %s", &answer) // get the user input Printf("Enter the colours of the resistor's three bands,\nbeginning with the band nearest to the end.\nType the coloues in lowercase letters only, NO CAPS.\n") įor (i = 0 i ", i + 1) // print headers for each band While (status = 'Y') //The program runs under this Int r, err, mult //holds the significant figure, Error, MultiplierĬhar resistor_value_string = "" //formatted output Long resistor_value = 0 //Total resistance Int scmp (char *a, char *b) //simple string comarisonĬhar status = 'Y' // Keeps the program running when user inputs 'Y'

Int srchItems (char *ccode) //a search for index valuesĬhar *strcpy2lower (char *dest, char *src) //converts to lower case #define nItems (sizeof item_list/sizeof *item_list) Here is the code that I've been working on: #include Įnum resistor_band_items If the second band or third band are invalid without the first band being invalid, the program will stop execution. And for #2 & #3 if and only if the first input (band 1) is invalid the program will run. Now I'm having a difficult time with getting the formatting for the total resistance (#1). Invalid colours: pink, silver Here are two invalid colours 'pink' and Should generate the following message in a single line: For example, if 'pink', 'silver', and 'red' are inputted as the resistor colours, the program
