hi, i can figure out why this program keeps counting up the cash variable more than once when i run it, like it'll be
10
10
10
10
10
11
11
11
11
11
and the percentage numbers have the letter "e" at the end of each percentage...
just seeing if i could get a hand cause i am stumped :(
// Produce a two-column table with column headings showing P% if the amounts$ 1$,2$,3$,...,20$. P is to be input,
____________________________________________________________________________________________________________________________________________________________
#include <iostream.h>
#include <conio.h>
int main()
{
double percentage,num2;
cout<<"Please insert percentage: ";
cin>>percentage;
num2=percentage*.01;
for(double cash=1;cash<=20;cash=cash+1)
{
num2=num2*cash;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
cout.width(10);cout<<cash<<endl;
cout<<num2<<endl;
}
cout<<endl;
return(0);
}