Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Input

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: input. Input means getting something, some kind of information, into a program while it is running.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial