Question: Write a program that implements the greedy change-making algorithm. [Algorithm 6 on page 199 of the text.] The algorithm should be implemented using a void

Write a program that implements the greedy change-making algorithm. [Algorithm 6 on page 199 of the text.] The algorithm should be implemented using a void function that accepts two arrays one for input of the coin amounts and one for output of the count of each coin. The prototype is

void greedyChangeMaker(const int[], int[], const int, int);

Heres the skeleton of the program :

Write a program that implements the greedy change-making algorithm. [Algorithm 6 on

sample ouput :

page 199 of the text.] The algorithm should be implemented using a

THANKS IN ADVANCE

Here is a skeleton: include Kiost ream #include kiomanip using namespace std; void greedychangeMaker (const int int const int, int) int main const int NUM COINS int coins [NUM COINS 125 10 5, 1); int count [NUM COINS 10 0, 0, 0); const char CENT SYM 155 int n; cout This program implements the greedy change-making algorithm endl; cout It will calculate the fewest number of quarters dimes nickels endl; cout and pennies necessary to make change for an inputted amount." endl; cout Enter the amount cin n; greedychangeMaker (coins count, NUM COINS n) output the results system ("pause") return 0 void greedychangeMaker (const int cti, int dll, const int r, int n) implementation of the algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!