Programming in Objective-C 2.0, Chapter 6, Exercise 6, Horribly broken


/ Published in: Objective C
Save to your folder(s)

Thanks for the hints, DC NSCoders. I've got a working version now. It might not be the most elegant, but it should work for all signed 32-bit integers.

> Write a program that takes an integer keyed from the terminal and extracts and displays each digit of the integer in English. So, if the user types in 932, the program should display the following:

nine
three
two

> (Remember to display 'zero' if the user types in just 0.) Note This exercise is a hard one!

The trick is, in the book, you haven't yet learned about arrays, so the solution must not include arrays. Nor do you "know" about file operations, string operations, or most other things that might prove useful here.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.