programming paradigms c1
TRANSCRIPT
![Page 1: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/1.jpg)
Pascal Programming Language
Omar ElSabek & Fayez GhazzawiIT Engineering3th year – UNKNOWN Department
![Page 2: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/2.jpg)
Welcome!
Hope you are doing fine!
![Page 3: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/3.jpg)
• Let’s think together !
• Why Pascal ?
• How we use the Pascal program ?
![Page 4: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/4.jpg)
What Do we need !
![Page 5: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/5.jpg)
• Test Question
• "Crack-the code" Section
• You need to try your self , otherwise
it won’t work out with u :(
• Practice , practice , practice …
![Page 6: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/6.jpg)
Programming Paradigms
Variables
Control Structures
Loop Statements
Arrays
Functions
Course Index :
![Page 7: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/7.jpg)
Programming Paradigms
• Moore's Law
• 30 years ago, Intel's cofounder, Gordon Moore, predicted that thecomputer processing power could be doubled every 18-24 months. Thisis measured by doubling the transistor count in a microprocessor. Thisprediction is now known as Moore s Law.
• Effects of Moore's Law on software
• Software applications ale becoming larger and more power at about thesame rate as hardware improvements allow.
• Language goals
• Bring modern approaches into the main stream in order to deal withthe increasing scale of programs - B. Stroustntp.
• To reduce development and maintenance cost new approaches inwriting programs were needed.
![Page 8: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/8.jpg)
Programming Paradigms
• A way to think about and organize computer data and code.
• Each paradigm has a set of languages.Categories of programming language paradigms:
• Imperative
• Procedural (e.g., Pascal, C)
• Object-oriented (e.g., C++,C#, Java)
• Declarative
• Functional (e.g., Lisp)
• Logic (e.g., Prolog)
![Page 9: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/9.jpg)
Programming Languages Wars
![Page 10: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/10.jpg)
• About The High Level Language Pascal
• Pascal is a high level computer language. That means that the programmer is highly removed from the actual machine code. Machine code, is the only language which a computer can really understand. Understanding, is maybe going too far, but any other language must go through some kind of translating stage before it can be run
![Page 11: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/11.jpg)
• Let’s try our First program
![Page 12: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/12.jpg)
Program Lesson1_Program1 (input,output);
Var
Begin
End.
![Page 13: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/13.jpg)
Program Lesson1_Program1 (input,output);
Var
Begin
End.
![Page 14: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/14.jpg)
Program Lesson1_Program1 (input,output);
Begin
Writeln ( ‘ Hello World. Prepare to learn PASCAL!! ‘) ;
Readln ;
End.
Hello World. Prepare to learn PASCAL!!
![Page 15: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/15.jpg)
• Read , Readln
Basic dealing structure for keyboard
• Write , Writeln
![Page 16: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/16.jpg)
• Constant :
have a specific value and have address in memory
• Variable :
It’s a specific place in memory with a name and address in memory
![Page 17: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/17.jpg)
Variables Allocation:
![Page 18: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/18.jpg)
Variables Allocation:
![Page 19: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/19.jpg)
Variable Name : type Name ;
i: Integer;r: Real;b: Boolean;s: String[5];
i r
b
s
Variables Allocation:
![Page 20: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/20.jpg)
Operator in Pascal !!
Multiply * Division /
Sum + subtract -
![Page 21: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/21.jpg)
Operator in Pascal !!
Div : the right part of division
Mod : The remainder of the division
In addition !
![Page 22: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/22.jpg)
Operator in Pascal !!
Mod work!
I mod J = I - ( I div J ) * J
![Page 23: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/23.jpg)
![Page 24: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/24.jpg)
(5 * 2) + 3 =
5 * 2 + 3 =
5 * (2 + 3) =
5 * 4 / 2 =
(5 * 4) / 2 =
5 * (4 / 2) =
13
13
25
10
10
10
![Page 25: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/25.jpg)
5 mod 2 =
2 mod 5 =
5 mod -2 =
-2 mod 5 =
-5 mod 2 =
2 mod -5 =
5 div 2 =
2 div 5 =
5 div -2 =
-2 div 5 =
-5 div 2 =
2 div -5 =
1
2
1
-2
-1
2
2
0
-2
0
-2
0
![Page 26: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/26.jpg)
![Page 27: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/27.jpg)
• Let’s see what you got!
Program Lesson1_Program1 (input,output);
Var
Sum , num1 , num2 : integer ;
Begin
writeln (‘please enter the First number’);readln (num1);writeln (‘please enter the second number’);readln (num2);sum := num1 + num2;writeln(num1 , ’+’ , num2 , ’=‘ , sum);
Readln ;
End.
![Page 28: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/28.jpg)
• Output!
![Page 29: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/29.jpg)
• Let’s see what you got!
Program Lesson1_Program1 (input,output);
Var
Sum , X ,Y : integer ;
Begin
………
End.
Program Lesson1_Program1 (input,output);
Var
Sum : integer ; X : integer ; Y : integer ;
Begin
………
End.
Is the same as …
![Page 30: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/30.jpg)
• Let’s see what you got!
Program Lesson1_Program1 (input,output);
Var
z , x , y : integer ;
Begin
Readln x;
Writeln x;
Z:= X * X ;
Y:= 4 * X ;
Writeln(Z , y);
readln;
End.
Calculate the area and Surroundings of square
![Page 31: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/31.jpg)
![Page 32: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/32.jpg)
برنامج الة حاسبة بسيطة يقوم بحساب العمليات األربعة لعددين
Calculate the area and Surroundings of circle
![Page 33: Programming paradigms c1](https://reader030.vdocument.in/reader030/viewer/2022020113/587281ce1a28abc7068b65b3/html5/thumbnails/33.jpg)