/********************************************** Write a function that gives change, i.e. it takes an amount as argument, and it prints out P's,N's,D's, and Q's - one for each penny, nickle, dime and quarter it gives out. Ex: If Amount is 33, it would print out QNPPP If you don't see why, would you care to play some poker? Your function should be recursive, and here's some simple rules to help you (let A be the amount you need change for): 1) If A is 0, don't give anything! 2) If A > 0, give out one of the largest denomination not exceeding A, then make change for the remaining amount. **********************************************/ #include using namespace std; void change(int A); int main134324() { int Amount; cout << "Enter amount: "; cin >> Amount; cout << "Change to give is: "; change(Amount); cout << endl; return 0; } void change(int A) { // base case if (A == 0) { return; } if (A >= 25) { // dole out quarter cout << "Q"; change(A-25); } else if (A >= 10) { // dole out dime cout << "D"; change(A-10); } else if (A >= 5) { // dole out nickel cout << "N"; change(A-5); } else { // dole out one penny cout << "P"; change(A-1); } return; // optional }