scoutdaa.blogg.se

Resistor code program
Resistor code program





resistor code program resistor code program

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

resistor code program

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'

resistor code program

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

  • Displaying more than one invalid colour.
  • Generates the following message: Invalid colour: vilet Here only For example, if 'brown', 'vilet', and 'red' are inputted as the resistor colours, the program A space has to be put between every 3 digits. For example, if the resistor value is "500000 -ohms", the format is required to be
  • Displaying the required format of the resistor value.
  • Type the colours in lowercaseĭo you want to decode another resistor (Y/N)? Enter the colours of the resistor’s three bands, beginning I'm trying to develop a C program that calculates the resistor values by inputting the colour bands marked on the resistor.Į.g.







    Resistor code program