Hi, I got this new homework assignment but am extremely lost since this is a fairly new topic. The assignment is:
Write a program that tells what coins to give out for any amount of change from 1 cent to 99
cents. Read the change values from the inputs.txt file that is provided. Store that file in the
same directory as the project file for this assignment.
Create an output file and name it as you wish. Store the results of the coin change in the output
file. For example, if the amount is 91 cents, the output written on the file would be something
like the following:
91 cents can be given as
3 quarter(s) 1 dime(s) 1 nickel(s) and 1 penny(pennies).
Im using codeblocks and need to connect a file called "inputs" with my main file and what I'm doing to do this is that Im putting it in workspace then within the project. I need to submit a "source file" so what exactly is that? Is it the main file? Also, how would I display the numbers with an output stream?
First you should design the program. Consider what inputs and outputs are required. What algorithm is needed in order to calculate the required change.
If you had to do this using pen & paper, how would you do this. What instructions would you give to someone who knew nothing about coins to undertake this?
One you have the program design, then you start to code the program from the design. Don't just start to code without first having a design. Code in small 'chunks' and test/debug each chunk of code before coding further.