resistor code

closed account (Nh79E3v7)
Write your question here.
Resistor is an electrical component that reduces an electric current. The resistor's ability to reduce current is called resistance and is measured in units of ohms, Ω. The resistance of a resistor and its tolerance are marked on the resistor by color bands that denotes the resistance value as shown in Figure 1. Table 1 shows the value of each colour band.


Figure 1: Resistor colour band. Table 1: Digit, multiplier and tolerance band chart. Colour 1st Band 2nd Band 3rd Band (Multiplier) 4th Band (Tolerance) Black 0 0 1 Brown 1 1 10 Red 2 2 100 Orange 3 3 1 000 Yellow 4 4 10 000 Green 5 5 100 000 Blue 6 6 1 000 000 Violet 7 7 10 000 000 Grey 8 8 100 000 000 White 9 9 1 000 000 000 Gold ±5% Silver ±10% None ±20%


You are required to design a program to determine the value of a resistor based on resistor colour code. The program should prompt users to request the 4 bands colour marked on the resistor. The result should be display along with its tolerance. The user then asked whether he/she want to continue to determine the value of other resistor or not. If the user enter “Y” or “y”, the program will continue, otherwise enter “N”or “n” the program will stop. The program also should prompt an error message if the user enter an invalid colour code. Bonus marks will be given to any group that can show the correct error message in each selection of colour code.


this is formula for colour band :

Example calculation By referring to Figure 1, the colour band of the resistor is as follow: 1st band : Red --------> 2 2nd band : Yellow ----> 4 3rd band : Green -----> 100 000 4th band : Silver ------> ±10% Thus, its resistance value is : Formula : [( 10 x 1st band ) + 2nd band ] x 3rd band ) ± 4th band % Resistance = [ (10 x 2 + 4) x 100 000] ±10% = 2 400 000 Ω ±10%


Put the code you need help with here.
#include <stdio.h>
#include <windows.h>
#include <math.h>

float colours(float);
void colors(char colors[10],float,float);
int main (void)
{
char colours [10][20];

int band[10]={0,1,2,3,4,5,6,7,8,9};
char colours[10],condition=1,i,j;
char name_colours [10][20]={"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"};
char name [10][20];


for(i=1;condition==1;i++)


{

printf (" Input: \t\t\t band:\n\n");
printf ("1. black \t\t\t 0\n");
printf ("2. brown \t\t\t 1 \n");
printf ("3. red \t\t\t 2 \n");
printf ("4. orange \t\t\t 3 \n");
printf ("5. yellow \t\t\t 4 \n\n");
printf ("6. green \t\t\t 5 \n\n");
printf ("7. blue \t\t\t 6 \n\n");
printf ("8. violet \t\t\t 7 \n\n");
printf ("9. grey \t\t\t 8 \n\n");
printf ("10. white \t\t\t 9 \n\n");

printf("Enter number of colours:");
scanf("%c",&colours);

}

int value;
strcpy(colours[i],name_colours[j]);


printf("choise band what you want:");
scanf("%d",&band[i]);
I don't see a question.
closed account (Nh79E3v7)
Resistor is an electrical component that reduces an electric current. The resistor's ability to reduce current is called resistance and is measured in units of ohms, Ω. The resistance of a resistor and its tolerance are marked on the resistor by color bands that denotes the resistance value as shown in Figure 1. Table 1 shows the value of each colour band.


Figure 1: Resistor colour band. Table 1: Digit, multiplier and tolerance band chart. Colour 1st Band 2nd Band 3rd Band (Multiplier) 4th Band (Tolerance) Black 0 0 1 Brown 1 1 10 Red 2 2 100 Orange 3 3 1 000 Yellow 4 4 10 000 Green 5 5 100 000 Blue 6 6 1 000 000 Violet 7 7 10 000 000 Grey 8 8 100 000 000 White 9 9 1 000 000 000 Gold ±5% Silver ±10% None ±20%


You are required to design a program to determine the value of a resistor based on resistor colour code. The program should prompt users to request the 4 bands colour marked on the resistor. The result should be display along with its tolerance. The user then asked whether he/she want to continue to determine the value of other resistor or not. If the user enter “Y” or “y”, the program will continue, otherwise enter “N”or “n” the program will stop. The program also should prompt an error message if the user enter an invalid colour code. Bonus marks will be given to any group that can show the correct error message in each selection of colour code.



this is formula for colour band :

Example calculation By referring to Figure 1, the colour band of the resistor is as follow: 1st band : Red --------> 2 2nd band : Yellow ----> 4 3rd band : Green -----> 100 000 4th band : Silver ------> ±10% Thus, its resistance value is : Formula : [( 10 x 1st band ) + 2nd band ] x 3rd band ) ± 4th band % Resistance = [ (10 x 2 + 4) x 100 000] ±10% = 2 400 000 Ω ±10%

I think this is a kind of advertisment? There is no question nor topic to discuss.
closed account (Nh79E3v7)
can u give to me your email or facebook name....i will send to u my c++ question
closed account (Nh79E3v7)
please help me
Please do not create duplicate posts. They waste everybody's time.
http://www.cplusplus.com/forum/beginner/191817/
http://www.cplusplus.com/forum/beginner/191749/
Topic archived. No new replies allowed.