program construction help

hi all, I need help doing this program.
{a C++ program that generates all the possible representations of N cents in the typical
American coins: quarters (25 cents), dimes (10 cents), nickels (5 cents), and pennies (1 cent). The
number of cents N must be a positive integer read from the keyboard.
Example: The sum of N = 20 cents can be represented as 2 dimes; or 1 dime and 2 nickels; or
1 dime, 1 nickel, and 5 pennies; or 6 other combinations of coins.
The representations must be written in a text file, one representation per line. The exact format
of a representation will be decided by you, but it must be clear to understand (that is, it must
contain the numbers of each type of coin used in the representation).
The name of the text file will contain the number of cents N. For instance, if you generate the
representations of 20 cents, the name of the text file must be Representations 20cents; if you gen-
erate the representations of 500 cents, the name of the text file must be Representations 500cents;
and so on.
Please note that the number of representations grows fast with N: for instance, one can represent 100 cents in 242 ways; 1000 cents can be represented in 142,511 ways. Therefore, your output
file can be pretty large.
Hint: You may write a recursive function that generates the representations of N cents.
}.Thank you all in advance
Please give your example output that you should have.
Last edited on
I think the output is supposed to be in a txt file. showing each possible representation on a line and the name of the txt file should be as demonstrated above ex:Representations 20cents

ex for the txt file for 20 cents

2 dime(s)
1 dime(s), 2 nickel(s)
1 dime(s), 1 nickel(s), 5 penn(ies)

OR something like that
Converting coins program?
Or likes a shop?
Last edited on
a program that see the probabilities of N cents would be in quarters dimes nickels and pennies, and output the number of probabilities in a .txt file, each probability in a line, and naming the .txt file in the name as the N cents representation, for N is a posotive integer
This seems hard.
I'll come back tommorow, with a proper and correct reference example. During that time you should think yourself and try again !!! (You'll get lucky...) :)

HTH
Last edited on
Topic archived. No new replies allowed.