in devc++ have been stuck for a solid 6 days on trying to figure out how to enter resistor value and how to get the colors back. I had to write a class for resistors. I have added my function for my first band and one of my functions in the main im trying to call. Please help me.
1. how do i get the function to read just the first and second value, then how do i count the leading zeros to get the color of the third resistor?
Thank you in advance
const string resistance::band_a(int x)
{ string color;
if(x == 1)
color = band_a[0];
elseif(x == 2)
color = band_a[1];
elseif(x == 3)
color = band_a[2];
elseif(x == 4)
color = band_a[3];
elseif(x == 5)
color = band_a[4];
elseif(x == 6)
color = band_a[5];
elseif(x == 7)
color = band_a[6];
elseif(x == 8)
color = band_a[7];
elseif(x == 9)
color = band_a[8];
else
cout << "Please enter a valid number from 1-9" << endl;
return color;
this is in my main
cout << "Please enter your resistor number without tolerance" << endl;
cin >> num;
if(num > 0.1 && num < 100000000)
while(num >=.1)
aaa = num*10; {
cout << band1.band_a(aaa);
}
}