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 :

sample ouput :
![page 199 of the text.] The algorithm should be implemented using a](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51b26b15e1_30266f51b264e9d6.jpg)
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
Get step-by-step solutions from verified subject matter experts
