This lesson covers the following topics:
Programming errors come in two main forms:
Pseudocode is one of the main tools programmers use while planning the logic and flow of a program. Pseudocode is not quite code and it's not quite English, it's a mixture of both that allows you to quickly write out the solution to your program without being slowed down by worrying about using proper syntax. You can think of pseudocode as "notes" for planning out a program.
Examples:
Number Doubling Program
start
input myNumer
set myAnswer = myNumber * 2
output myAnswer
stop
Old Enough to Drive Program
start
input age
if age < 16:
print "You cannot drive."
else:
print "You can drive."
stop
Add Numbers Program
start
total = 0
num = input("Enter a number or 0 to quit: ")
while num != 0:
total = total + num
num = input("Enter a number or 0 to quit: ")
output total
stop
Flowcharts are another main tool programmers use while planning the logic and flow of a program. Flowcharts show the same solution as pseudocode, except in a more visual form. Below are a few of the basic shapes used to create flowcharts.
Examples:
Number Doubling Program
Add Numbers Program
Old Enough to Drive Program
Below are the three fundamental programming structures of computer science. Theoretically, you can create any program that has ever been written using only these three structures. As you place these structures into your flowchart, you can both stack them (one structure on top of another) or nest them (one structure inside of another). This is referred to as stacking and nesting.