Saturday, April 14, 2007
Turing, Ch. 10 and 11
- Chapter 10 is short and simple. You learn
- how to get input from a text file (rather than from the keyboard) using Run With Args on the menu bar
- how to output to a text file (rather than to the screen)
- how to use the end-of-file (eof) marker when getting input from a file
- how to get an entire line of input at once (rather than one word at a time)
Don't spend too much time on Chapter 10. Try the programs in the textbook, learn how to use files, then move on to Chapter 11. There will NOT be a test on Chapter 10. You need to know it for later chapters.
Chapter 11 (Handling Strings) gets quite interesting. There will be a couple of small sections that require you to concentrate, but if you get the basic tools down at the beginning, it will not be a problem.
- The first part of the chapter shows you several basic tools for manipulating strings in Turing.
- finding the length of a string with length()
- joining (catenating) strings with the + operator
- selecting part of a string, e.g. word (4..6)
- searching for a pattern in a string e.g. index ("dandelion", "lion")