Class Crib Notes for CPSC 110 Brent Dingle
Wednesday, January 30, 2002
Reminders:
Quiz is Wed. and Thurs. in lab.
Lab Assignment 2 is due Feb 6 and 7
Review:
Input functions:
Read and Readln (mostly use Readln in this class)
Output functions:
Write
and Writeln
Assignment operator is :=
Type compatibility (example: real = int is ok, int = real is NOT)
3 Types of errors:
1.
Syntax errors are violations of the syntax
(grammar) rules of the programming language.
2.
Runtime errors occur when a program is running (EX:
division by zero)
3.
Logical errors are mistakes in the algorithm itself.
Robustness – how well does
the program deal with the unexpected/exceptional.
Software Life Cycle – 6 Phases
§
Analysis
and task specification.
§
Design
of the software.
§
Implementation
(coding).
§
Testing.
§
Maintenance
and evolution of the system.
§
Obsolescence.
Comparison Operators ( <, <=, =, >=, >,
<> )
Boolean Expression
(x = 5)
AND,
OR, NOT
Conditional Statements (if statements)
While Loops
Infinite
Unitialized
Compound statements – definition (multiple
statements between begin and end)
If
– Example:
Say
we wanted to see if someone’s name was Hampton and if it is we need to tell
them something. We would need to write a program to ask for the person’s name
and check if it was Hampton. If it was we would tell them something. Otherwise
we do nothing.
Loop
example:
Suppose
there were many people we might need to ask the name of – would we want to run
the program many times? or just once? Here we modify the above example to use a
while loop instead of an if statement. This program would run ‘forever’ or
until Hampton was found.
–
some
predefined functions (like writeln and readln are predefined proecedures)
–
inputing
and outputting to and from (text) files