I have a program to write as part of assignment for class, using C++ of course and using functions. Basically I have to write a Resistor Colour Code Calculator which will allow a user to input the colours and it would give them a value as well as a tolerance range. I am currently having trouble writing the part for the first two bands which are the significant figures. Form what I can see I need to call the Significant Figures function twice, and I have no idea how to do it.

int sigfig () //Significant Figures Function
{
string sband1,sband2,sband3,sband4;
int nband,nband2,nband3,nband4, count;

cout << "Please enter colour of band 1";
cin >> sband1;
//while (count !=1)
//{
//count = count +1;
if (sband1 == "black")
{
nband=0;
}

int main() // Main Function
{
string band1, band2, band3, band4, result, colour, func, band;

band1 = sigfig ();
cout << band1;

cout << "Please enter colour of band 2";
cin >> band2;

band2 = sigfig ();
cout << band2;

cout << "Please enter colour of band 2";
cin >> band2;
cout << "Please enter colour of band 3";
cin >> band3;
cout << "Please enter colour of band 4";
cin >> band4;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.