CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Dec 2009
    Posts
    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

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Programing Help

    Sigh. You'll be waiting a while. We're real programmers because we did our own homework.

  3. #3
    Join Date
    Dec 2009
    Posts
    26

    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);
    	}

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: solution

    Quote Originally Posted by sufood View Post
    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.

  5. #5
    Join Date
    Dec 2009
    Posts
    26

    Re: C++ Programing Help

    okay

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Programing Help

    Quote Originally Posted by sufood View Post
    okay
    It's still there.

  7. #7
    Join Date
    Dec 2009
    Posts
    26

    Re: C++ Programing Help

    i know

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Programing Help

    Quote Originally Posted by sufood View Post
    i know
    So why go against the policies of the board by doing somebody's homework?

  9. #9
    Join Date
    Dec 2009
    Posts
    26

    Re: C++ Programing Help

    i have more important things to worry about.

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Programing Help

    Quote Originally Posted by sufood View Post
    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?

  11. #11
    Join Date
    Dec 2009
    Posts
    26

    Re: C++ Programing Help

    that's of no concern to me.

  12. #12
    Join Date
    Apr 1999
    Posts
    27,449

    Re: C++ Programing Help

    Quote Originally Posted by sufood View Post
    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

  13. #13
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Programing Help

    Quote Originally Posted by Paul McKenzie View Post
    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.

  14. #14
    Join Date
    Dec 2009
    Posts
    26

    Re: C++ Programing Help

    I was poking fun at how simple the homework question was. it's called SARKASM.

  15. #15
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured