; makechange ; Dat Thuc Nguyen ; 22 November 2003 ; ; How many different ways can we make change of \$1.00, given half-dollars, ; quarters, dimes, nickels, and pennies? The solution in Scheme is given ; in the book Structure and Interpretation Of Computer programs by Harold ; Abelson. Below is the solution in C-Kermit scripting language. It's not ; about counting change only, but it's about C-Kermit scripting language's ; ability to solve a wide variety of computational problems. The key ; is you don't need Delphi or C++ at all while using C-Kermit. define count_change { ; \%1 amount to be changed (cc \%1 5) } define cc { ; \%1 amount to be changed ; \%2 kinds-of-coins (if (== \%1 0) 1 (if (OR (< \%1 0) (== \%2 0)) 0 (+ (cc \%1 (- \%2 1)) (cc (- \%1 (first_denomination \%2)) \%2)))) } define first_denomination { ; \%1 kinds-of-coins (if (== \%1 1) 1 (if (== \%1 2) 5 (if (== \%1 3) 10 (if (== \%1 4) 25 (if (== \%1 5) 50))))) } (count_change 100) ; for one dollar (count_change 50) ; for half-dollar