For Dummies Beginning Programming with C++ 978-0-470-61797-7 사용자 설명서

제품 코드
978-0-470-61797-7
다운로드
페이지 12
12
Part I: Let’s Get Started 
As detailed as these instructions might seem to be, this is not a program. 
This is called an algorithm. An algorithm is a description of the steps to be 
performed, usually at a high level of abstraction. An algorithm is detailed but 
general. I could use this algorithm to repair any of the flat tires that I have 
experienced or ever will experience. But an algorithm does not contain suf-
ficient detail for even our intentionally obtuse human computer to perform 
the task.
The Tire Changing Language
Before we can write a program, we need a language that we can all agree on. 
For the remainder of this book, that language will be C++, but I use the newly 
invented TCL (Tire Changing Language) for this example. I have specifically 
adapted TCL to the problem of changing tires.
TCL includes a few nouns common in the tire-changing world:
 ✓ 
car
 ✓ 
tire
 ✓ 
nut
 ✓ 
jack
 ✓ 
toolbox
 ✓ 
spare tire
 ✓ 
wrench
TCL also includes the following verbs:
 ✓ 
grab
 ✓ 
move
 ✓ 
release
 ✓ 
turn
Finally, the TCL-executing processor will need the ability to count and to 
make simple decisions.
This is all that the tire-changing robot understands. Any other command 
that’s not part of Tire Changing Language generates a blank stare of incom-
prehension from the human tire-changing processor.
05_617977-ch01.indd   12
05_617977-ch01.indd   12
7/6/10   11:38 PM
7/6/10   11:38 PM