Im doing the tutorials over at 3dbuzz and my assigment is to create a program that calculates a capacitors resistance based on its colors. My first version of this code did just that, it worked fine and all was good, when I turned it in, the guy said (I used a bunch of switch statements for it) to get rid of all that unecesary code. After a day of pondering I figured out a new method. This works but he also wants the output arranged as 3000 = 3k; 4,500,000 = 4.5M etc.My question is, Is there any way to keep this set up and still produce it as 4.5M etc instead of all the zeros? Thanks in advance to anyone that can help me.Code:
if (band1 == 0)
{
cout<<"Your resistor has "<<band2;
for (int increase = 0; increase < band3; increase++)
{
cout<<"0";
}
cout<<" Ohms of resistance"<<endl;
}
else
{
cout<<"Your resistor has "<<band1<<band2;
for (int increase = 0; increase < band3; increase++)
{
cout<<"0";
}
cout<<" Ohms of resistance."<<endl;
}