Programming Handout 1
Programming Handout 1
Information Technology
Programming Handout
Computer programming languages are classified into two categories namely, high-level
languages and low-level languages. The most fundamental difference between the two is
that low-level languages are closer to the system hardware and require the knowledge of
hardware to write the instructions; whereas high-level programming languages are the
machine independent languages that do not require the hardware knowledge to write
instructions.
Debugging is the process of finding and resolving defects or problems within a computer
program that prevent correct operation of computer software or a system.
When the computer is interpreting or compiling a program that is your source code, an error,
whether major or minor will cause it to either produce (output) results or not reach the stage
of output at all. There are different types of errors which will cause your program to ‘crash’.
Logic errors
Logic errors occur when the programmer makes mistakes in the sequence of the program
statements such using the wrong formula or function ( ie using a MOD instead of SQR
FUNCTION). The program will usually compile that the compiler converts the source code
to object code. NOTE: that compilation with logic errors does not generate any syntax errors
or any warning messages but when the program is run it produces the wrong results.
Syntax errors
Syntax errors occur when a mistake is made in the programming language rules or violating
the rules governing the structure of the language. In short a syntax error occurs when the
programmer fails to follow the rules of the programming language exactly. For example if a
keyword such as input or print is spelt incorrectly or an endif was left out.
Program documentation includes hard-copy or electronic manuals that enable users, program
developers, and operators to interact successful with a program. User documentation
normally consists of a user's manual. This manual may provide instructions for running the
program. A description of software commands, several useful examples of applications, and
troubleshooting guide to help with difficulties.
Sample Pascal Program
Write a pascal program that prompts the user to enter three numbers. Reads the three
numbers calculate and print their sum.
Program Numbers;
Var
Num1, Num2, Num3, Sum: Integer;
Begin
Write(‘Please enter a number’);
Readln(Num1);
Sum:= Num1+Num2+Num3;
Write (Sum);
End.