void say(const int n) /* This function is guaranteed to work every positive int */ { if (n < 0) print("User error: number out of range"); else if (n < 20) print(smalls[n]); else if (n < 100) { const int digit1 = n / 10; const int digit2 = n % 10; print(tens[digit1]); if (digit2 != 0) { print("-"); say(digit2); } } else if (n < 1000) { const int digit1 = n / 100; const int restdigs = n % 100; say(digit1); print(" hundred"); if (restdigs != 0) { print(" and "); say(restdigs); } } else if (n < 1000000) { const int firstdig = n / 1000; const int restdigs = n % 1000; say(firstdig); print(" thousand "); if (restdigs != 0) { if (restdigs < 100) print("and "); say(restdigs); } } else { const int firstdig = n / 1000000; const int restdigs = n % 1000000; say(firstdig); print(" million "); if (restdigs != 0) { if (restdigs < 100) print("and "); say(restdigs); } } }