Beispiel #1
0
Resistor::Resistor(float _resistance,float _tolerance)
{
	resistance=_resistance;
	tolerance=_tolerance;
	closestStandardResistor();
	calcColors();
	calcTolcolors();
	Notation notation;
	notation.toHumanNotation(resistance,modifier);
}
Beispiel #2
0
void Resistor::calcResistance()
{
	map<string,int> colcodeMap=constructColcodeMap();
	unsigned int i;
	resistance=0;
	for (i=0;i<colors.size()-1;i++) {
		resistance=resistance*10+colcodeMap[colors[i]];
		colcodes.push_back(colcodeMap[colors[i]]);
	}
	resistance=resistance*pow(10,colcodeMap[colors[i]]);
	colcodes.push_back(colcodeMap[colors[i]]);
	Notation notation;
	notation.toHumanNotation(resistance,modifier);
}