/* * Coins.C -- ECS 122A CM from PR * * Program to count minimum number of US coins 1, 10, 25 * coins to make change. * * Shows memoization. * * */ #include const c1 = 1, c2 = 10, c3=25 ; // Values of the three kinds of coins const huge = 0x7fffffff; const maxn = 10000; // Maximum value the program runs on int min(int a, int b, int c=huge, int d=huge) // 2-4 inputs work // finds minimum or a,b,c,d { int r = a> cents; if (cents>maxn) exit(1); cout << "Can make " << cents << " using " << NCoins(cents) << " coins\n"; return 0; }