| | |
Urgent Help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 13
Reputation:
Solved Threads: 0
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);
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);
•
•
Join Date: Jan 2006
Posts: 13
Reputation:
Solved Threads: 0
•
•
•
•
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:
•
•
•
•
Originally Posted by caseg
yeah i had wrote it myself,
•
•
•
•
Originally Posted by caseg
just because i am kinda a rooky
•
•
•
•
Originally Posted by caseg
dis my work... ='(
•
•
Join Date: Feb 2006
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by caseg
return(0);
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:
![]() |
Similar Threads
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
- URGENT: Need help on I/O code! (Java)
- Urgent help (Networking Hardware Configuration)
- Homepage keeps switching back to a porn site (Web Browsers)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the C++ Forum
- Previous Thread: How to use interface of a dll which is developed in C#>NET in my VC++.NET appli
- Next Thread: Address book problems....Any advice???
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






