my program runns but it isnt coming out right, i need to have on the left side my input*.01*cash and on the right side the chas sequencing 1-20
the problem is the cash numbers are counting more than once before going on to the next number for example:
1
1
1
1
2
2
2
and on the left my input that had been multiple following across down keeps having the letter "e" after each time it shows a number... this is what i am told to do...Produce a tow-column table with column headings showing P% of the amounts $1,$2,3$,...,20$. P is to be the input.

Please help me get this right i am new and horrible to this, please help, (been trying for 2 hours now)
i have my crappy working source code that outputes the wrong things
#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);

Recommended Answers

All 8 Replies

did you really write that program? or did you just copy it from somebody else? Look closely and you will see that it is printing the same thing over, and over and over one each iteration. But of course you already know that if you had written it youself :rolleyes:

Why are you doing cout so many times inside the loop? You're going to get like 400 printouts...

did you really write that program? or did you just copy it from somebody else? Look closely and you will see that it is printing the same thing over, and over and over one each iteration. But of course you already know that if you had written it youself :rolleyes:

yeah i had wrote it myself, just because i am kinda a rooky at this doesn't mean you can dis my work... ='(

yea u only need 1 cout statement since its a loop and all the other couts are the same thing

yeah i had wrote it myself,

Good -- just checking because the question you asked makes one believe otherwise.

just because i am kinda a rooky

We've all been there, done that.

dis my work... ='(

I have no idea what that means. :eek:

I have no idea what that means. :eek:

caseg is probably from the UK, because "diss" is Brit-slang for "disrespect". :)

caseg is probably from the UK, because "diss" is Brit-slang for "disrespect". :)

It also is bad english for...making fun of... :rolleyes:

return(0);

for starters....that should be
return 0;
it doesnt really dont need the ( )


also
#include <iostream.h>
#include <conio.h>


u dont need the .h after them i belive on some compilers

and if ur compile wont compile it use

char response;
std::cin >> response;
return 0;


cuz i got to use that in Dev to see the prgrm :eek:

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.