CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2013
    Posts
    1

    C++ Programming Help!

    Please build this program for me so I can dissect it and study each line!

    Write a C++ program to calculate the fewest number of each denomination needed to pay a bill of amount TOTAL. For example, if the end user enters $97 for TOTAL, program will output that the bills would consist of one $50 bill, two $20 bills, one $5 bill, and two $1 bills. (Assume that the amount is in whole dollars, no cents, and only $100, $50, $20, $10, $5, and $1 denominations are available.) Aid: You may want to use the modulus operator %.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: C++ Programming Help!

    We don't write your homework for you! Please read http://forums.codeguru.com/showthrea...ork-assignment.

    If you try to write a program for this problem and post the code here, we'll give you advice about it but you need to write it first. If you post code, please use code tags (go advanced, select code, click '#')
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: C++ Programming Help!

    Quote Originally Posted by epoon317 View Post
    Please build this program for me so I can dissect it and study each line!

    Write a C++ program to calculate ...
    So how much are you going to pay for such a work made for you?
    And if you are read to pay then please, move your post to the correspondent Forum (like Open Positions (Jobs))

    If you are not going to pay then you'll need to do your work yourself, and 2kaud already wrote how it could be done.
    Victor Nijegorodov

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

    Re: C++ Programming Help!

    Quote Originally Posted by epoon317 View Post
    Please build this program for me so I can dissect it and study each line!
    If you want to "study each line", then why this specific example? Why not another example? C++ is C++, regardless of what the program is supposed to do, so if you really wanted to "study each line", then you would get any C++ program and "study it". So in truth, this is really homework, isn't it?

    Forget about C++ for the moment. Do you know how to calculate the fewest number of bills, regardless of whether you know C++ or not? What if someone asked you to write down the steps to get you the fewest number of bills. Can you do that? If you can, then you translate those steps into a program. If you don't know the steps to figure out the problem, then that is where you start.

    Regards,

    Paul McKenzie

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

    Re: C++ Programming Help!

    Here you go.

    Code:
    for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: C++ Programming Help!

    Interesting display for output!
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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