-
March 4th, 2013, 11:30 PM
#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 %.
-
March 5th, 2013, 04:13 AM
#2
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)
-
March 5th, 2013, 04:28 AM
#3
-
March 5th, 2013, 05:15 AM
#4
Re: C++ Programming Help!
Originally Posted by epoon317
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
-
March 5th, 2013, 08:22 AM
#5
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);
-
March 5th, 2013, 08:39 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|