O'Reilly logo

Objective-C Programming: The Big Nerd Ranch Guide by Mikey Ward, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Challenge: user input

So far, the programs you have written do some work and then output text to the console. In this challenge, you will modify your CountDown solution to ask for input from the user. In particular, you will ask the user what number the countdown should start from.

To make this happen, you need to know about two new functions: readline() and atoi() (pronounced A to I).

The readline function is the opposite of printf(). Rather than printing text to the screen, it gets text that user has entered.

Before you can use readline(), you must first add the library that contains it to your program.

In the project navigator, click the top-level Coolness item. In the editor area, click Build Phases and then the disclosure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required