Program related to electronics students.Give exact value by mentioning color codes. Converts to Kilo or Mega ohm if value is greater than itself can be used by electronics students for various purposes. It is to be used as a part of Software engineering projects.
void main()
{
start:
clrscr();
int i;
float r=0;
char a[10],b[10],c[10],d[10];
cout<<“_____________________________!Color code Reader
1.0!____________________________”;
cout<<“Design by:A.Cherma rajan.BE.,”;
cout<<“Enter your Resister colour code here
“;
cout<<“Code 1:”;
cin>>a;
cout<<“Code 2:”;
cin>>b;
cout<<“Code 3:”;
cin>>c;
{
if(!(strcmp(a,”black”)))
r=0;
else if(!(strcmp(a,”brown”)))
r=10;
else if(!(strcmp(a,”red”)))
r=20;
else if(!(strcmp(a,”orenge”)))
r=30;
else if(!(strcmp(a,”yellow”)))
r=40;
else if(!(strcmp(a,”green”)))
r=50;
else if(!(strcmp(a,”blue”)))
r=60;
else if(!(strcmp(a,”violet”)))
r=70;
else if(!(strcmp(a,”gray”)))
r=80;
else if(!(strcmp(a,”white”)))
r=90;
}
{
if(!(strcmp(b,”black”)))
r+=0;
else if(!(strcmp(b,”brown”)))
r+=1;
else if(!(strcmp(b,”red”)))
r+=2;
else if(!(strcmp(b,”orenge”)))
r+=3;
else if(!(strcmp(b,”yellow”)))
r+=4;
else if(!(strcmp(b,”green”)))
r+=5;
else if(!(strcmp(b,”blue”)))
r+=6;
else if(!(strcmp(b,”violet”)))
r+=7;
else if(!(strcmp(b,”gray”)))
r+=8;
else if(!(strcmp(b,”white”)))
r+=9;
}
{
if(!(strcmp(c,”black”)))
r*=1;
else if(!(strcmp(c,”brown”)))
r*=10;
else if(!(strcmp(c,”red”)))
r*=100;
else if(!(strcmp(c,”orenge”)))
r*=1000;
else if(!(strcmp(c,”yellow”)))
r*=10000;
else if(!(strcmp(c,”green”)))
r*=100000;
else if(!(strcmp(c,”blue”)))
r*=1000000;
else if(!(strcmp(c,”violet”)))
r*=10000000;
else if(!(strcmp(c,”gray”)))
r*=100000000;
else if(!(strcmp(c,”white”)))
r*=1000000000;
}
cout<<“Colour code value for your Resister:”;
if(r/999999>=1)
cout<<r/1000000<<” M”;
else if(r/999>=1)
cout<<r/1000<<” K”;
else
cout<<r<<” “;
char ch=234,op;
cout<<ch;
cout<<”
Continue (y/n):”;
cin>>op;
if(op==’y’)
goto start;
else
exit(1);
getch();
}