0% found this document useful (0 votes)
191 views12 pages

Teacher Powerpoint

The document provides an introduction to Pascal programming for students. It outlines the objectives of developing a simple algorithm, examining the basic program structure, and converting the algorithm to a Pascal program with correct syntax. An example scenario of creating a student record program is provided. The basic Pascal program structure of using keywords like PROGRAM, VAR, BEGIN, END, WRITE, READ, and variables is explained. Students are given activities to write algorithms, pseudocode, and convert them into a Pascal program to collect student records based on the example provided.

Uploaded by

api-292491710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views12 pages

Teacher Powerpoint

The document provides an introduction to Pascal programming for students. It outlines the objectives of developing a simple algorithm, examining the basic program structure, and converting the algorithm to a Pascal program with correct syntax. An example scenario of creating a student record program is provided. The basic Pascal program structure of using keywords like PROGRAM, VAR, BEGIN, END, WRITE, READ, and variables is explained. Students are given activities to write algorithms, pseudocode, and convert them into a Pascal program to collect student records based on the example provided.

Uploaded by

api-292491710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

I N T R O D U C T I O N T O PA S C A L

PROGRAMMING

FRIDAY 13TH NOVEMBER 2015.


SWAHA HINDU COLLEGE

DONE BY: Salma V. Hosein

SYNTAX

&

LOGIC

in

PA S C A L

TODAYS OBJECTIVES

Develop a simple algorithm / pseudocode to


input, and output data before writing a program.
Examine the basic structure of a program.
Convert the written algorithm / pseudocode to a
Pascal program with correct syntax.

Activity 1
Students Record Card
First Name: __________________________
Address: _____________________________

Last Name: __________________


Contact No: _______________

Scenario:

Your school has finally decided to computerise the schools form one registration process.
They have decided to enlist this task to the form 4 IT students. You have been asked to
create a program that will enter the relevant information that is needed for this registration.
This must be ready in time for the next registration period. Above shows an example of
some information on a students record card.
Write an algorithm / pseudodode based on the example of the students record card.

Time to complete 2 mins

Activity 1
Students Record Card
First Name: __________________________
Last Name: ___________________
Address : _____________________________ Contact No: _______________

Algorithm
1.
2.
3.
4.
5.

START
Enter Students First and Last Name.
Input Address.
Accept Contact No
STOP

Activity 1

Pseudocode based on the scenario


1. Start
2. Print Enter students first and last name
3. Input Fname, Lname {Fname First Name,
Lname Last Name}

4.
5.
6.
7.
8.

Print Enter address


Input Address
Print Enter Contact No
Input Tele
{Contact no}
Stop.
Time to complete 3 mins

Basic Structure of Pascal


Program
Reserve word PROGRAM must start all
programs.
All lines must end with ; (semi-colon)

PROGRAM title;

This is followed by the program name (single


word, no spaces or punctuation and any
length)
Reserve word VAR short for variables. These must be declared.
These are areas of memory identified by a name written into the
program. Variables must contain single words, can be letters and
numbers and cannot start with a number.
Variable name and their data type. Variables
Days: string; months: string;
are assigned data type using : (colon) symbol.
It could also be written as days, months: string;

VAR

BEGIN
Write;
Read;
END.

Reserve word BEGIN must start main


program
Reserve word WRITE is used to display messages on the
screen
Reserve word READ used to accept input from the user
from the keyboard.
Reserve word END is used to end a programs. It must end
with a full stop.

Example 1 of Pascal Program


PROGRAM first;
BEGIN
Write(Hello, this is my first program);
Readln;
END.
Q: Where is the cursor located?

Example 2 of Pascal Program


PROGRAM first;
VAR
group: string;
BEGIN
Write(Hello, this is my first program);
Writeln(I am in group: );
Readln(group);
Writeln(I am in form 4 group ,group);
END.
Q: Whats the difference between Write
& Writeln?

Activity 2
Answers
1. This command displays text on the screen.
WRITE/WRITELN
2. This command accepts input from the user.

READ /

READLN
3. A program in Pascal must start with what reserved word.
PROGRAM
4. A program must end with what reserve word.

END

5. At the end of statements we use this symbol.

6. We end the main program using this symbol.

7. To declare a variable the command is.

VAR

8. Data type are assigned to variables using what symbol. :

Activity 3
Working in Pairs
Write a program using PASCAL that accepts input from the user in
order to fill in the relevant information based on the scenario in Activity
1. Your school has indicated that the program should include your
mother name and reprint the address you entered previously as
Address: . This additional information is required to be on the
Students record card. Use the new coding language structure you have
just learnt.
Time to complete activity 10 mins

Activity 1
1. Start
2. Print Enter
students first and
last name
3. Input Fname,
Lname
4. Print Enter
address
5. Input Address
6. Print Enter
Telephone No.
7. Input Tele

Activity 3
Program registration;
Var
Fname, Lname, Address, Tele, Mname:
string;
Begin {main prog} (1)
Write(Enter students first and last
name); (2)
Readln (Fname, Lname); (3)
Writeln(Enter address); (4)
Readln(Address); (5)
Writeln(Enter contact no: ); (6)
Read(tele); (7)
Writeln(Enter mother name: ); ( *)
Read(Mname); (*)
Writeln (Address: , address);

(Reprint 5)
End. {main prog} ( 8)

THE END
THANK YOU !!

You might also like