|
-
December 15th, 2009, 06:43 PM
#1
C++ Programing Help
Hello to all code gurus! First of, I wouldn't lie, i am not a professional programmer.....I am more of the opposite. I was given a program to write during a 4 day C++ programmers boot camp that I signed up for (which ended friday actually). By profession am a graphic designer and a rising web developer, specializing in all of the adobe an corel suites, except for a adobe indesign which I find not so helpfull at times. I want to see how the code I was given on one of the handouts could be implemented into a fully functional program for my personal use. I would like to see what functions, arrays an system calls you guys would use to get this done. Here is the question below:
Read in three values representing respectively:
a capital sum (integer number of pence),
a rate of interest in percent (float),
and a number of years (integer).
Compute the values of the capital sum with compound interest added over the given period of years.
Each year's interest is calculated as
interest = capital * interest_rate / 100;
and is added to the capital sum by
capital += interest;
Print out money values as pounds (pence / 100.0) accurate to two decimal places.
Print out a floating value for the value with compound interest for each year up to the end of the period.
Print output year by year in a form such as:
Original sum 30000.00 at 12.5 percent for 20 years
Year Interest Sum
----+-------+--------
1 3750.00 33750.00
2 4218.75 37968.75
3 4746.09 42714.84
4 5339.35 48054.19
5 6006.77 54060.96
6 6757.62 60818.58
7 7602.32 68420.90
8 8552.61 76973.51
9 9621.68 86595.19
10 10824.39 97419.58
Cant wait to see how u guys would do this!! I feel So elated being among a bunch of real programmers!!
Thankz, JoJoMak
-
December 15th, 2009, 09:05 PM
#2
Re: C++ Programing Help
Sigh. You'll be waiting a while. We're real programmers because we did our own homework.
-
December 16th, 2009, 12:55 PM
#3
solution
I stayed up all night coding and after hundreds of revisions this is what I came up with:
Code:
float cap;
float rate;
int years;
cout << "Enter your capital loser!";
cin >> cap;
cout << "Enter interest rate loser!";
cin >> rate;
cout << "How many years loser!";
cin >> years;
for(int i=0; i<years; i++) {
float interest = rate * cap / 100;
cap += interest;
printf("%d %.2f %.2f\n", i+1, interest, cap);
}
-
December 16th, 2009, 01:26 PM
#4
Re: solution
 Originally Posted by sufood
I stayed up all night coding and after hundreds of revisions this is what I came up with:
Please delete your post. We don't do homework for people here.
-
December 16th, 2009, 01:50 PM
#5
-
December 16th, 2009, 02:44 PM
#6
Re: C++ Programing Help
 Originally Posted by sufood
okay
It's still there.
-
December 16th, 2009, 02:46 PM
#7
-
December 16th, 2009, 03:51 PM
#8
Re: C++ Programing Help
 Originally Posted by sufood
i know
So why go against the policies of the board by doing somebody's homework?
-
December 16th, 2009, 04:05 PM
#9
Re: C++ Programing Help
i have more important things to worry about.
-
December 16th, 2009, 04:42 PM
#10
Re: C++ Programing Help
 Originally Posted by sufood
i have more important things to worry about.
Are you trying to help people or just show off? What do you think they learn if you just do the work for them?
-
December 16th, 2009, 04:48 PM
#11
Re: C++ Programing Help
that's of no concern to me.
-
December 16th, 2009, 07:06 PM
#12
Re: C++ Programing Help
 Originally Posted by sufood
i have more important things to worry about.
Like what? You stated you went through "hundreds of revisions". How long did that take?
Regards,
Paul McKenzie
-
December 16th, 2009, 07:28 PM
#13
Re: C++ Programing Help
 Originally Posted by Paul McKenzie
Like what? You stated you went through "hundreds of revisions". How long did that take?
Regards,
Paul McKenzie
Good point. He says he stayed up all night doing it. I don't see why somebody who's been here for three days would want to go against the policies of the board. Not much to be gained by it.
If that code took all night and hundreds of revisions, he'll be needing help himself sooner than later and that attitude won't help.
-
December 16th, 2009, 07:56 PM
#14
Re: C++ Programing Help
I was poking fun at how simple the homework question was. it's called SARKASM.
-
December 16th, 2009, 08:11 PM
#15
Re: C++ Programing Help
SARKASM??
Is that assembly language written by the programmers of the Isle of Sark??
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|