Chapter 5. Input

Until now, if you wanted your program to “crunch some numbers,” you had to put those numbers right in the code. For example, if you wrote the temperature-conversion program in the “Try it out” section of chapter 3, you probably put the temperature to convert right in the code. If you wanted to convert a different temperature, you would have to change the code.

What if you want to have the user enter any temperature she wants when the program runs? We said before that a program has three components: input, processing, and output. Our first program had only output. The temperature-conversion program had some processing (converting the temperature) and some output, but no input. It’s time to add the third ingredient to our programs: ...

Get Hello World! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.