944,047 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1802
  • C++ RSS
Feb 27th, 2006
0

Urgent Help

Expand Post »
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);
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
caseg is offline Offline
13 posts
since Jan 2006
Feb 27th, 2006
0

Re: Urgent Help

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:
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Feb 27th, 2006
0

Re: Urgent Help

Why are you doing cout so many times inside the loop? You're going to get like 400 printouts...
Reputation Points: 68
Solved Threads: 18
Posting Pro in Training
winbatch is offline Offline
466 posts
since Feb 2005
Feb 27th, 2006
0

Re: Urgent Help

Quote originally posted by Ancient Dragon ...
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... ='(
Reputation Points: 10
Solved Threads: 0
Newbie Poster
caseg is offline Offline
13 posts
since Jan 2006
Feb 28th, 2006
0

Re: Urgent Help

yea u only need 1 cout statement since its a loop and all the other couts are the same thing
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
tyczj is offline Offline
91 posts
since Mar 2005
Feb 28th, 2006
0

Re: Urgent Help

Quote originally posted by caseg ...
yeah i had wrote it myself,
Good -- just checking because the question you asked makes one believe otherwise.

Quote originally posted by caseg ...
just because i am kinda a rooky
We've all been there, done that.

Quote originally posted by caseg ...
dis my work... ='(
I have no idea what that means. :eek:
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Feb 28th, 2006
0

Re: Urgent Help

Quote ...
I have no idea what that means. :eek:
caseg is probably from the UK, because "diss" is Brit-slang for "disrespect".
Reputation Points: 307
Solved Threads: 62
Posting Pro
Bench is offline Offline
565 posts
since Feb 2006
Feb 28th, 2006
0

Re: Urgent Help

Quote originally posted by Bench ...
caseg is probably from the UK, because "diss" is Brit-slang for "disrespect".
It also is bad english for...making fun of... :rolleyes:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Whodey is offline Offline
10 posts
since Feb 2006
Feb 28th, 2006
0

Re: Urgent Help

Quote originally posted by caseg ...
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:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Whodey is offline Offline
10 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC