Professional Documents
Culture Documents
P2 Pseudocode
P2 Pseudocode
9618
BASIC SYNTAX
Operators In Pseudocode
Multiplication *
Division /
Addition +
Subtraction -
Variables And Input
Declaration is necessary
FirstName = "Taha"
LastName = "Ali"
FullName = FirstName & LastName
Selection Statement
There are 2 selection statements in Pseudocode
IF ...........THEN..........ELSE..........ENDIF
CASE.......OF..........OTHERWISE.........ENDCASE
Syntax Of IF Statement
IF (condition)
THEN
Instruction
ELSEIF (condition)
THEN
Instruction
ELSE
ENDIF
ENDIF
Operators In Selection Statement
AND OR
Both Condition Any one Condition
Should Be True Should Be True
PRACTICE QUESTION
3) Pre-Conditional
WHILE...DO....ENDWHILE
FOR....TO....NEXT
FOR Count = 1 to 10
.....
.....
Repetition Know .....
Count-Controlled Loop ENDFOR
No Condition
No Use Of Count = Count + 1
LOGIC : Fixed Iteration always executes
WHILE....DO....ENDWHILE
Count = 0
WHILE Count < 10 DO
Count =Count + 1
Repetition Unknown
.....
Conditional Loop
.....
Pre-Condition
ENDWHILE
Use of Count = Count + 1
LOGIC : Loop will run until condition remains True
REPEAT....UNTIL
Count = 0
REPEAT
Count = Count + 1
Repetition Unknown ......
Conditional Loop ......
Post-Condition UNTIL Count = 10
Use of Count = Count + 1
LOGIC : Loop will run until condition remains False
Question
2) Counting TECHNIQUE
Count = 0 (Outside the loop)
Count = Count + 1 (Inside the loop)
QUESTION
Small Technique
Small = 9999 (Outside the loop)
Condition Number < Small then Small = Number
Question
ARRAYS
Concept Of Arrays
Upper 5 "Pappan"
Bound
4 "Banto"
3 "Bano"
2 "Pappu"
1 "Ahmed"
Lower
0 "Taha"
Bound
Names
What is Array ?
2 "Pappu"
Names[4] 1 "Ahmed"
Names[5] 0 "Taha"
Names
How to Declare the Array
4
Declaration Of 2D Array
ROWS COLUMN
DECLARE NameOfArray : ARRAY [ L.B : U.B, L.B : U.B ] OF DataType
FOR Count = 1 TO 10
FOR Index = 1 To 5
Print ("PAPERSDOCK")
ENDFOR
ENDFOR
0 1 2 3
0 21
Number[2,1] 5 1
Number[4,1] 78 2 5
Number[3,3] 54 3 54
4 78
Number
Question
FILES
Purpose Of File
FOR Index = 1 TO 54
INPUT Value
ID = LEFT( Value , 4)
WRITEFILE "New.txt" , ID
ENDFOR
Appending To A File
FILES
What are Functions ?
Subroutines
Function Procedure
ENDFUNCTION
Header Of Procedure
ENDPROCEDURE
Question