Question: I have a code of a program that can run and need to modify some values, please help to modify the code of the program.

I have a code of a program that can run and need to modify some values, please help to modify the code of the program.

here is original question and original code:

 I have a code of a program that can run and

original code:

#include #include #include struct resist_value { char COL[10]; // COLOR_CODES_TOL for resistor band colours int VAL; // VAL for resistor band values (for bands one to three) float TOL; // TOL for resistor tolerance (for band four) }; // The colour bands, band values and tolerances are defined in the array COLOR[10] struct resist_value RESIST[13] = { { "black" ,0,-1 }, // -1* means no tolerance is illustrated for the colour { "brown" ,1,1 }, { "red" ,2,2 }, { "orange",3,-1 }, // -l' means no tolerance is illustrated for the colour { "yellow",4,-1 }, // -l' means no tolerance is illustrated for the colour { "green",5,0.5 }, { "blue",6,0.25 }, { "violet",7,0.1 }, { "grey",8,-1 }, // -l means no tolerance is illustrated for the colour { "white",9,-1 }, // -1' means no tolerance is illustrated for the colour { "gold",-1,5 }, // '-1' means no tolerance is illustrated for the colour { "silver" ,-1 ,10 }, // '-1' means no tolerance is illustrated for the colour { "",-1 ,20 } // "" and -1 means no colour band; }; int main() { char band1[10], band2[10], band3[10], band4[10]; int b[3] = { -1 }, valid = 1, i; double tol; long res; char ch; do {

b[0] = -1; b[1] = -1; b[2] = -1; printf("Enter the colors of the resistor's four bands, beginning with the band nearest the end. Type the colors in lowercase letters only, NO CAPS. "); printf("Band 1 => "); scanf(" %s", band1); printf("Band 2 => "); scanf(" %s", band2); printf("Band 3 => "); scanf(" %s", band3); while (getchar() != ' '); printf("Band 4 => "); gets(band4);//scanf(" %s", band4); for (i = 0; i "); //ch = getchar(); scanf(" %c", &ch); //getch(); } while (ch == 'Y');

}

HERE is the modify question:need to modify some values, please help to modify the code of

sample run:the program. here is original question and original code: original code: #include

plz just tell me the modify code.

Question 2. (S.5 marks0 A resistor is an electric circuit device component and it has a specific resistance value, where the resistance values are expressed in ohms (2). Resistors are generally marked with four colored bands that encode their resistance values which are shown in the following figure. First digit Second digit Multiplier Tolerance (Band one) (Band two) (Band three) (Band four) The first two bands (Band one and Band two are the first and the second digits. The third band (Band three is a power-of-ten multiplier. The fourth band (Band four indicates the tolerance of the resistor which is the percentage deviation of the desired resistance value, measured at 25C. The table below shows the meanings of each band color. For example, if the first band is green, the second is black, the third is orange and the fourth is red, the resistor has a value of 50x10 with a tolerance of 2%. Color Value as digit Value as multiplier Tolerance (%0 (Bands one and two) (Band three) (Band four) Black 10 Brown Red 10 Orange Yellow 0.5 Green Blue 0.25 Violet 0.1 Grey 10 White 10 Gold Silver 10 No color 20

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!