Class Crib Notes for CPSC 110                                           Brent Dingle

                                                 Monday, January 28, 2002

 

Reminders:

Homework is due today and tomorrow.

Quiz is Wed. and Thurs. in lab.

 

Input functions:

Read and Readln  (mostly use Readln in this class)

 

Output functions:

            Write and Writeln

            Formatting numbers (of type real)

 

Assignment operator is :=

 

Type compatibility (example: real = int is ok,   int = real is NOT)

 

Each line in a program is a statement.

 

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.

 

Example programs to demonstrate the above based on the below:

PROGRAM AddTwo

VAR

   n1, n2, sum : integer;

BEGIN

   writeln(‘Enter two numbers’);

   readln(n1, n2);

   sum := n1 + n2;

   writeln(n1, ‘ plus ‘, n2, ‘ = ‘, sum);

END.

 

 

Software Life Cycle – 6 Phases