Urgent Help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2006
Posts: 13
Reputation: caseg is an unknown quantity at this point 
Solved Threads: 0
caseg caseg is offline Offline
Newbie Poster

Urgent Help

 
0
  #1
Feb 27th, 2006
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);
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Urgent Help

 
0
  #2
Feb 27th, 2006
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:
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: Urgent Help

 
0
  #3
Feb 27th, 2006
Why are you doing cout so many times inside the loop? You're going to get like 400 printouts...
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 13
Reputation: caseg is an unknown quantity at this point 
Solved Threads: 0
caseg caseg is offline Offline
Newbie Poster

Re: Urgent Help

 
0
  #4
Feb 27th, 2006
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... ='(
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 91
Reputation: tyczj is an unknown quantity at this point 
Solved Threads: 1
tyczj tyczj is offline Offline
Junior Poster in Training

Re: Urgent Help

 
0
  #5
Feb 28th, 2006
yea u only need 1 cout statement since its a loop and all the other couts are the same thing
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,406
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Urgent Help

 
0
  #6
Feb 28th, 2006
Originally Posted by caseg
yeah i had wrote it myself,
Good -- just checking because the question you asked makes one believe otherwise.

Originally Posted by caseg
just because i am kinda a rooky
We've all been there, done that.

Originally Posted by caseg
dis my work... ='(
I have no idea what that means. :eek:
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 487
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 48
Bench's Avatar
Bench Bench is online now Online
Posting Pro in Training

Re: Urgent Help

 
0
  #7
Feb 28th, 2006
I have no idea what that means. :eek:
caseg is probably from the UK, because "diss" is Brit-slang for "disrespect".
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 10
Reputation: Whodey is an unknown quantity at this point 
Solved Threads: 0
Whodey Whodey is offline Offline
Newbie Poster

Re: Urgent Help

 
0
  #8
Feb 28th, 2006
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:
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 10
Reputation: Whodey is an unknown quantity at this point 
Solved Threads: 0
Whodey Whodey is offline Offline
Newbie Poster

Re: Urgent Help

 
0
  #9
Feb 28th, 2006
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:
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC