Hi Alex,
In a message of to All (), you wrote:
AW> Hi All
AW> I'm a student studying C++ programming. I've got an assignment
AW> question where I don't even have an idea how to attack the
AW> problem. The program is to input a value (like $1. $2. $5..)
AW> and spit out a table showing all the different cominations of coins
AW> that could be used to make up that value. So for $0.10 the table
AW> would look like:
AW> 10 = 10
AW> 10 = 5 + 5
AW> 10 = 5 + 1 + 1 + 1 + 1 + 1
AW> 10 = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
This is a classic programming task.
The easiest approach (IMHO) could be this: You receive an input
value, you have a series of diferent coins (10 cents, 25 cents, etc.). I
wolud first try to give the the total amount in the lower of the coins (say
return 1 cents coins). Then return one of the inmediate lower (say 5 cents)
and the rest in 1 cents. Repeat this for the rest of the coins.
Good luck!!!
Bye, Andres.
> mailto: atarallo@chasque.apc.org
--- The-Box Point 0.15- PC
---------------
* Origin: L'Imagination au Pouvoir (4:850/9.24)
|