SlideShare a Scribd company logo
Prog_2 course- 2014 
2 bytes team 
Kinan keshkeh 
IT Engineering-Damascus University 
3rd year
Let’s Remember!! SomeOf Prog_1 :D
Program 2Bytes_pro; 
Uses wincrt; 
Var k,x,y,z :integer; 
Procedure proc1(a:integer; var b:integer ;) 
var i,x: integer; 
Begin 
i:=10; x:=7; y:=12; a:=2; b:=4; 
end; 
Begin 
x:=3; y:=5; proc1(k,z); 
Writeln(„z=„,z); 
Writeln(„k=„,k); 
Writeln(„x=„,x); 
Writeln(„y=„,y); 
Writeln(„i=„,i); 
End. 
+1 
+1 
+1 
+1 
+1 
{ z=4 } 
{Random value often be zero} 
{ x=3 } 
{ y=12 } 
{ error }
In procedures and functions There are four types of variables : 
1.General Variables : are variables that are written at the top of the program befor all procedures and functions and we can see it and deal with it by all procedures and functions in the main program (like : k , x , y , z) . 
2.Local Variables : are variables that are declared in the statements part within procedure or function and we can‟t see it and deal with it outside that procedures (like : i , x ) . 
3.Formality Variables : are variables that appear in the header of procedure or function and it is formality and is not reserved place for it in memory (like a , b ) 
 we have two types of formality variables 
1) input variables : Keeps the value entered by after the completion of the procedural ( like : a) 
2)output variables : Keeps the value obtained by the procedure. And we writes before it the reserved word (var) (like : b ) 
4.Actual Variables : are variables that main program pass it to procedure or function during a summons and it agree formality variables in number and type (like : k , z)
Notes : 
Local variables have priority from general variables in the same Field of vision ( ايؤرنا لاجي ) ( like : x) 
 Execution always start form (begin) by the main program 
 in string : 
var : name , lname : string ; 
begin writeln(„enter the name and lname „); 
readln(name , lname); 
writeln(name); 
writeln(lname); 
End. 
Ahmed 
Ali 
Inputs : 
Ahmed Ali 
X nothing 
outputs 
name); 
readln(lname); 
+1
SETS 
A П B 
A 
B
What is a DiscreteType?? 
Discrete Data Type: 
Integer 
boolean 
char 
Enumerated 
Day=(sat,sun,mon,tu,wed,th,fri) 
Like..
Definition 
The SET is a Data Structure which contain discrete type elements .. 
Doesn‟t have index.!! 
<Nameof varible > :Set of < discrete type > 
We can‟t define the set as this form : 
S : Set of Integer; 
Because set can have 256 components at most and all its component values should be in rang 0 .. 255 .
Ex: 
•S1 : Set of 1..100; 
•S2 : Set of „a‟..‟z‟; 
•S : Set of Days; 
•S : Set of 66..256; 
•S: set of char ; 
{True} 
{True} 
{True} 
{False} 
+1 
{True}
Set Handling 
Var: 
s1:set of 0..255; 
S2,s3:set of 40..100; 
S4:set of „a‟..‟z‟;
S1 := [ 55, 80, 99, 80, 600, 41, 44..55]; 
Isn‟t added 
S1: 
41 44..55 80 99
S1 : 
S1 := [];
S2 := [200,20]; 
S2: 
40..100 
“NO Change”
S4 := [‘B’,’A’,’c’,’a’]; 
S4: 
„a‟ „c‟
S4 := [I,k]; 
Var I,k:integer; 
i:=1; k:=k+1; 
+1 
S4: 
Compile Error !!
S1 := [I,j]; 
Var I,j:integer; 
i:=1; j:=i*9; 
+1 
S1: 
1,9
i, j : integer; i := 1; j := i-1; S1 := [i, j]; S1 := S1 + [i*2]; 
S1: 
0,1,2 
+1
S1:=S4; 
+1 
Error 
Ya fahmaneen !! :D
Operation 
•To put a value in it , we use [value] . 
•The operations on Sets : 
⋂ ⇔ * 
⋃ ⇔ + 
/ ⇔ - 
⊆ ⇔ <= 
⊇ ⇔ >= 
∈ ⇔ in
Program SetsOperator; Var A0 : set of 1..15; A1 : set of 1..10; A2 : set of 5..15; i : integer; Begin A1 := [1..10]; A2 := [5..15]; A0 := A1*A2; {A0=[5..10]} A0 := A1+A2; {A0=[1..15]} A0 := A1-A2; {A0=[1..4]} A0 := A0-[1]; {A0=[2..4]}
A1 := [2,3]; 
A2 := [1,2,3,4,5]; 
if (A1 <= A2) then {or (A2 >= A1)} 
writeln ('A1 is a subset of A2'); 
readln (i); 
if (i in A1) then 
writeln (i,' is in A1') 
else 
writeln (i,' is not in A1'); 
End;
True statement 
A0, A1 : Set of 1..15; A : boolean; A0 := [1, 2]; A1 := [2, 4]; A0 := A0 – [77]; A := A1 >= A0; A := 1 in A0;
Const Sets 
Type 
Digits = set of 0..9; 
Const 
HexD : set of '0'..'z‘ = 
['0'..'9', 'A'..'F', 'a'..'f']; 
ED : Digits = [0, 2, 4, 6, 8]; 
Var 
d : Digits; 
Begin 
d := [8]; 
d := ED; {d=[0,2,4,6,8]} 
ED:=ED+[9]; 
ED:=d; 
End. 
+1 
Error .. Fateh 3eoonk !!
Enum Set 
Type 
Day = (sun,mon,….,sat); 
Name=(koko,soso,fofo,fifi); 
Var 
days: Set of Day; 
N:set of Name 
Begin 
Days:=[sun..sat]; 
N:=[KOKO,SOSO]; 
End.
Read & Print Sets :
Program Test(); Type SInt = Set of 1..150 ; SCh = Set of ‘0’..’z’; Var S1 : SInt; S2 : SCh; Slen : Integer; Begin Readln(Slen); ReadsetI(S1 , Slen); ReadsetC(S2 , Slen); PrintsetI(S1 , Slen); PrintsetC(S2 , Slen); Readln; End.
Read Integer Sets 
Procedure ReadsetI (var S:SInt; L:integer) ; 
var 
i, x : integer; 
Begin 
s:=[]; 
For i:=1 to L do 
begin 
Read(x); 
S := S + [x]; 
end; 
End;
Read Char Sets 
Procedure ReadsetC (var S:SCh; L:integer) ; var i, x : Char; Begin s:=[]; For i:=1 to L do begin Read(x); S := S + [x]; end; End;
Print Integer Sets Using While Loop: 
Procedure PrintsetI (S : SInt) ; 
var 
I : Integer; 
Begin 
I := 0; 
While ( S <> []) do 
If (I in S) then 
begin 
Writeln(I); 
S := S – [I]; 
end; 
I := I + 1; 
End;
Print Integer Sets Using For Loop 
Procedure PrintsetI (S : SI) ; var I : Integer; Begin For I:=1 to 32700 do Begin If (I in S) then Begin Writeln(I); S := S – [I]; End; If (S = []) then I := 32700; End; End;
Exercise : 
يرى في يؼهذ يا إػطاء دوراخ في يادذي انرياضياخ وانهغح الإ كَهيسيح 
يؼطى كم طانة ػ ذُ ذسجيهه في ان ؼًهذ رقى فريذ يحصىر تي 1..100 فإرا ػه دً أ ػذد انطلاب في كم يادج لا يرجاوز 50 طانة 
ان طًهىب كراتح تر اَيج ػاو تاسرخذاو الاجرائياخ وان جً ىًػاخ ورنك 
نهقياو تان هًاو انرانيح : 
. 
1 ذشكيم يج ىًػح نطلاب انرياضياخ ويج ىًػح نطلاب انهغح 
الإ كَهيسيح )إدخال ػ اُصر ان جً ىًػح ( 
. 
2 إجراء نطثاػح ػ اُصر ان جً ىًػح 
. 
3 إجراء لإػطاء يج ىًػح تأرقاو انطلاب ان سًجهي تان اًدذي . 
4 قررخ إدارج ان ؼًهذ ذخفيض ػذد انطلاب ورنك تالاسرغ اُء ػ ػذد 
يحذد ي هُى يذخم ي نىحح ان فًاذيح ػهى أ يرى اخريار أرقاو 
انطلاب ان فًصىني تشكم ػشىائي وان طًهىب كراتح إجراء ن قُم 
أرقاو انطلاب ان فًصىني إنى يج ىًػح جذيذج 
. 
5 وضغ أرقاو انطلاب ان فًصىني ض شؼاع
Program prog2byte_team; 
Uses wincrt; 
Type students=set of 1..100; 
numbers=array[1..50] of 1..100; 
Var seng,smath : students; 
Procedure inputset(var s : students; m:integer); 
Var i,x: integer; 
Begin 
s:=[ ]; 
i:=0; 
While (i<m) do 
begin 
writeln(„input students number „); 
readln(x); 
if (x in s) then 
writeln(„ you input this number befor please enter 
another number „) 
else 
begin 
i:=i+1; 
s:=s+[x]; 
end; 
end; 
End; 
numbers of students
Procedure printset(s :students); 
Var i:integer; 
Begin 
i:=1; 
While (s<>[ ]) do 
begin 
if (i in s) then 
begin 
write(i:5); 
s:=s-[ i ]; 
end; 
i:=i+1; 
end; 
writeln; 
End;
Procedure bothsub(s1,s2 : students; var s3: students); 
Begin 
s3:=s1*s2; 
End;
Procedure deletestd(var s,n : students); 
Var k,i,x ; integer; 
Begin 
n:= [ ]; 
Randomize; 
i:=0; 
Writeln(„enter the number you want to go throw out „); 
Readln(x); 
While (i<x) do 
begin 
k:= random(100) + 1; 
if ( k in s ) then 
begin 
s:=s – [ k ]; 
seng:= seng – [ k ]; 
smath:=smath – [ k ]; 
i:=i+1; 
n:=n + [ k ]; 
end; 
end; 
End; 
بلاطنا حػىًجي 
ان فًصىني يج ىًػح 
انرقاطغ 
:Randomize يقىو ترىنيذ 
أرقاو ػشىائيح أػر اًدا ػهى 
ساػح ان ظُاو 
:Random(100)=0..99; 
Random(100)+1=1..100
Procedure setinArray(s: students; var a: numbers ; var k: integer); 
Var i : integer; 
Begin 
K:=0; 
For i:=1 to 100 do 
If (i in s) then 
begin 
k:=k+1; 
a[k]:=i; 
end; 
End; 
ي أجم اسرذػاء 
انشؼاع في انثر اَيج 
انرئيسي
Var nmath,neng,k,i :integer; 
Aunaccepted : numbers; 
Sunaccepted,sboth : students; 
Begin 
Writeln(„enter the number of math students „); 
Readln(nmath); 
Inputset(smath,nmath); 
Writeln(„enter the number of English students „); 
Readln(neng); 
Inputset(seng,neng); 
Bothsub(smath , seng , sboth); 
Printset(sboth); 
Deletestd(sboth,Sunaccepted); 
Printset(Sunaccepted); 
setinArray(Sunaccepted,Aunaccepted,k); 
For i:=1 to k do 
Writeln(Aunaccepted[i]:5); 
Readln; 
End.
Homework: 
Creat and read two arrays of student numbers, student numbers in Prog and in English. 
-We want to know the students numbers at the two subjects..?! 
-what are the student numbers at the Prog and Not at English ?? 
+10 point
Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 
2 bytes team
Revision Practise
Ques: 
write a programme DO: 
1-Read An Array 2-Print An Array//Proce 
3-function to find the min elem in the array 
4-Procedure to find the Sum array(of the tow arrays). 
5- Multi array 
Write the Main Program..
Programme P-Matrix; 
Const nMax=20; mMax=20; 
Type Matrix=array[1..nmax,1..mmax] of real; 
Var A,B,Add,mult :Matrix; 
n1,n2 :1..nmax; 
m1,m2 :1..mmax; 
min: integer;
Procedure ReadMat(Var: n:1..nmax;var m:1..mmax; var A:matrix); 
Var i,j:integer; 
begin 
writeln(„enter the first Dimention of matrix< ‟ ,nmax); 
Readln(n); 
writeln(„enter the second Dimention of matrix< ‟ ,mmax); 
Readln(m); 
for i:=1 to n do 
begin 
for j:=1 to m do read(A[I,j]); {hint} 
readln; {hint} 
end; 
end;
Procedure WriteMat(Var: n:1..nmax;var m:1..mmax; var A:matrix); 
Var i,j:integer; 
begin 
for i:=1 to n do 
begin 
for j:=1 to m do write(A[i,j],‟ ‟); 
writeln; 
end; 
end;
Function MinOfMatrix(n:1..nmax,m:1..mmax;A:matrix):real 
Var i,j:integer; min:real; 
begin 
min:=A[1,1]; 
For i:=1 to n do 
for j:=1 to m do 
if (A[i,j]<min) then 
min:=A[i,j]; 
MinOfMatrix:=min; 
end;
Procedure Add_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix); 
Var i,j:integer; 
begin 
if(n1<>n2)or(m1<>m2) then 
writeln(„the addition is impossible‟); 
else 
begin 
n3:=n1; m3:=m1; 
for i:=1 to n3 do 
for j:=1 to m3 do 
C[i.j]:=A[i,j]+B[i,j]; 
end; 
end;
Procedure Mult_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix); 
Var i,j,k:integer; 
begin 
if(n1<>m2) then 
writeln(„the multi is impossible‟); 
else 
begin 
n3:=n2; m3:=m1; { A(m1,n1)*B(m2,n2)=C(m3,n3)} 
for i:=1 to n3 do 
for j:=1 to m3 do 
begin 
C[i,j]=0; 
for k:=1 to m2 
C[i.j]:= C[i.j] +A[i,k]*B[k,j]; 
end; 
end; 
end;
Begin 
ReadMat(n1,m1,A); WriteMat(n1,m1,A); 
ReadMat(n2,m2,B); WriteMat(n2,m2,B); 
writeln(„the minimum of the first Mat = ‟); 
min:=MinOfMatrix(n1,m1,A); writeln(min); 
Add_Tow_Matrix(n1.m1,n2,m2,A,B,n3,m3,Add); 
WriteMat(n3,m3,Add); 
Mult_Tow_Matrix(n1,n2,m1,m2,A,B, n3,m3,mult); 
WriteMat(n3,m3,mult); 
End;
Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 
2 bytes team

More Related Content

What's hot

Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languages
Eelco Visser
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointers
Sushil Mishra
 
C programs
C programsC programs
C programs
Vikram Nandini
 
Pnno
PnnoPnno
Ada file
Ada fileAda file
Ada file
Kumar Gaurav
 
Lec23-CS110 Computational Engineering
Lec23-CS110 Computational EngineeringLec23-CS110 Computational Engineering
Lec23-CS110 Computational Engineering
Sri Harsha Pamu
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::Exporter
Ricardo Signes
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
John De Goes
 
Algorithm and Programming (Array)
Algorithm and Programming (Array)Algorithm and Programming (Array)
Algorithm and Programming (Array)
Adam Mukharil Bachtiar
 
M|18 User Defined Functions
M|18 User Defined FunctionsM|18 User Defined Functions
M|18 User Defined Functions
MariaDB plc
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
imtiazalijoono
 
Functional Stream Processing with Scalaz-Stream
Functional Stream Processing with Scalaz-StreamFunctional Stream Processing with Scalaz-Stream
Functional Stream Processing with Scalaz-Stream
Adil Akhter
 
Scalaz
ScalazScalaz
Scalaz
mpilquist
 
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Philip Schwarz
 
FS2 for Fun and Profit
FS2 for Fun and ProfitFS2 for Fun and Profit
FS2 for Fun and Profit
Adil Akhter
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
Deyvessh kumar
 

What's hot (20)

Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languages
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointers
 
C programs
C programsC programs
C programs
 
Pnno
PnnoPnno
Pnno
 
Ada file
Ada fileAda file
Ada file
 
Lec23-CS110 Computational Engineering
Lec23-CS110 Computational EngineeringLec23-CS110 Computational Engineering
Lec23-CS110 Computational Engineering
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::Exporter
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
 
Algorithm and Programming (Array)
Algorithm and Programming (Array)Algorithm and Programming (Array)
Algorithm and Programming (Array)
 
M|18 User Defined Functions
M|18 User Defined FunctionsM|18 User Defined Functions
M|18 User Defined Functions
 
C program
C programC program
C program
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Functional Stream Processing with Scalaz-Stream
Functional Stream Processing with Scalaz-StreamFunctional Stream Processing with Scalaz-Stream
Functional Stream Processing with Scalaz-Stream
 
Scalaz
ScalazScalaz
Scalaz
 
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
 
FS2 for Fun and Profit
FS2 for Fun and ProfitFS2 for Fun and Profit
FS2 for Fun and Profit
 
java sockets
 java sockets java sockets
java sockets
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
BCSL 058 solved assignment
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
 

Similar to 2Bytesprog2 course_2014_c1_sets

Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02
Md. Ashikur Rahman
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
kinan keshkeh
 
Kumpulan contoh-program-pascal
Kumpulan contoh-program-pascalKumpulan contoh-program-pascal
Kumpulan contoh-program-pascalrey25
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
Kandarp Tiwari
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
Hazrat Bilal
 
C Language Lecture 17
C Language Lecture 17C Language Lecture 17
C Language Lecture 17
Shahzaib Ajmal
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
Elsayed Hemayed
 
Array Array Array Array Array Array Arra
Array Array Array Array Array Array ArraArray Array Array Array Array Array Arra
Array Array Array Array Array Array Arra
FaysalAhamed32
 
Programs.doc
Programs.docPrograms.doc
Programs.doc
ArnabNath30
 
AI-Programs.pdf
AI-Programs.pdfAI-Programs.pdf
AI-Programs.pdf
ArnabNath30
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
ManojKhadilkar1
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Make Mannan
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
Prof. Dr. K. Adisesha
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Er Ritu Aggarwal
 
CLISP Lab Manual - Dr.J.VijiPriya
CLISP Lab Manual - Dr.J.VijiPriyaCLISP Lab Manual - Dr.J.VijiPriya
CLISP Lab Manual - Dr.J.VijiPriya
VijiPriya Jeyamani
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 

Similar to 2Bytesprog2 course_2014_c1_sets (20)

Struct examples
Struct examplesStruct examples
Struct examples
 
Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02Cse115 lecture08repetitionstructures part02
Cse115 lecture08repetitionstructures part02
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
 
Kumpulan contoh-program-pascal
Kumpulan contoh-program-pascalKumpulan contoh-program-pascal
Kumpulan contoh-program-pascal
 
Kumpulan program pascal
Kumpulan program pascalKumpulan program pascal
Kumpulan program pascal
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
C Language Lecture 17
C Language Lecture 17C Language Lecture 17
C Language Lecture 17
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
 
Array Array Array Array Array Array Arra
Array Array Array Array Array Array ArraArray Array Array Array Array Array Arra
Array Array Array Array Array Array Arra
 
Programs.doc
Programs.docPrograms.doc
Programs.doc
 
AI-Programs.pdf
AI-Programs.pdfAI-Programs.pdf
AI-Programs.pdf
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
 
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)Lab manual operating system [cs 502 rgpv] (usefulsearch.org)  (useful search)
Lab manual operating system [cs 502 rgpv] (usefulsearch.org) (useful search)
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
CLISP Lab Manual - Dr.J.VijiPriya
CLISP Lab Manual - Dr.J.VijiPriyaCLISP Lab Manual - Dr.J.VijiPriya
CLISP Lab Manual - Dr.J.VijiPriya
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 

More from kinan keshkeh

10 Little Tricks to Get Your Class’s Attention (and Hold It)
10 Little Tricks to Get Your  Class’s Attention (and Hold It)10 Little Tricks to Get Your  Class’s Attention (and Hold It)
10 Little Tricks to Get Your Class’s Attention (and Hold It)
kinan keshkeh
 
Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods
kinan keshkeh
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm  GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm
kinan keshkeh
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...
kinan keshkeh
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
kinan keshkeh
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
kinan keshkeh
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
kinan keshkeh
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
kinan keshkeh
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
kinan keshkeh
 
2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance
kinan keshkeh
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces
kinan keshkeh
 

More from kinan keshkeh (20)

10 Little Tricks to Get Your Class’s Attention (and Hold It)
10 Little Tricks to Get Your  Class’s Attention (and Hold It)10 Little Tricks to Get Your  Class’s Attention (and Hold It)
10 Little Tricks to Get Your Class’s Attention (and Hold It)
 
Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm  GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
 
2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces 2 BytesC++ course_2014_c10_ separate compilation and namespaces
2 BytesC++ course_2014_c10_ separate compilation and namespaces
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 

2Bytesprog2 course_2014_c1_sets

  • 1. Prog_2 course- 2014 2 bytes team Kinan keshkeh IT Engineering-Damascus University 3rd year
  • 3. Program 2Bytes_pro; Uses wincrt; Var k,x,y,z :integer; Procedure proc1(a:integer; var b:integer ;) var i,x: integer; Begin i:=10; x:=7; y:=12; a:=2; b:=4; end; Begin x:=3; y:=5; proc1(k,z); Writeln(„z=„,z); Writeln(„k=„,k); Writeln(„x=„,x); Writeln(„y=„,y); Writeln(„i=„,i); End. +1 +1 +1 +1 +1 { z=4 } {Random value often be zero} { x=3 } { y=12 } { error }
  • 4. In procedures and functions There are four types of variables : 1.General Variables : are variables that are written at the top of the program befor all procedures and functions and we can see it and deal with it by all procedures and functions in the main program (like : k , x , y , z) . 2.Local Variables : are variables that are declared in the statements part within procedure or function and we can‟t see it and deal with it outside that procedures (like : i , x ) . 3.Formality Variables : are variables that appear in the header of procedure or function and it is formality and is not reserved place for it in memory (like a , b )  we have two types of formality variables 1) input variables : Keeps the value entered by after the completion of the procedural ( like : a) 2)output variables : Keeps the value obtained by the procedure. And we writes before it the reserved word (var) (like : b ) 4.Actual Variables : are variables that main program pass it to procedure or function during a summons and it agree formality variables in number and type (like : k , z)
  • 5. Notes : Local variables have priority from general variables in the same Field of vision ( ايؤرنا لاجي ) ( like : x)  Execution always start form (begin) by the main program  in string : var : name , lname : string ; begin writeln(„enter the name and lname „); readln(name , lname); writeln(name); writeln(lname); End. Ahmed Ali Inputs : Ahmed Ali X nothing outputs name); readln(lname); +1
  • 6. SETS A П B A B
  • 7. What is a DiscreteType?? Discrete Data Type: Integer boolean char Enumerated Day=(sat,sun,mon,tu,wed,th,fri) Like..
  • 8. Definition The SET is a Data Structure which contain discrete type elements .. Doesn‟t have index.!! <Nameof varible > :Set of < discrete type > We can‟t define the set as this form : S : Set of Integer; Because set can have 256 components at most and all its component values should be in rang 0 .. 255 .
  • 9. Ex: •S1 : Set of 1..100; •S2 : Set of „a‟..‟z‟; •S : Set of Days; •S : Set of 66..256; •S: set of char ; {True} {True} {True} {False} +1 {True}
  • 10. Set Handling Var: s1:set of 0..255; S2,s3:set of 40..100; S4:set of „a‟..‟z‟;
  • 11. S1 := [ 55, 80, 99, 80, 600, 41, 44..55]; Isn‟t added S1: 41 44..55 80 99
  • 12. S1 : S1 := [];
  • 13. S2 := [200,20]; S2: 40..100 “NO Change”
  • 15. S4 := [I,k]; Var I,k:integer; i:=1; k:=k+1; +1 S4: Compile Error !!
  • 16. S1 := [I,j]; Var I,j:integer; i:=1; j:=i*9; +1 S1: 1,9
  • 17. i, j : integer; i := 1; j := i-1; S1 := [i, j]; S1 := S1 + [i*2]; S1: 0,1,2 +1
  • 18. S1:=S4; +1 Error Ya fahmaneen !! :D
  • 19. Operation •To put a value in it , we use [value] . •The operations on Sets : ⋂ ⇔ * ⋃ ⇔ + / ⇔ - ⊆ ⇔ <= ⊇ ⇔ >= ∈ ⇔ in
  • 20. Program SetsOperator; Var A0 : set of 1..15; A1 : set of 1..10; A2 : set of 5..15; i : integer; Begin A1 := [1..10]; A2 := [5..15]; A0 := A1*A2; {A0=[5..10]} A0 := A1+A2; {A0=[1..15]} A0 := A1-A2; {A0=[1..4]} A0 := A0-[1]; {A0=[2..4]}
  • 21. A1 := [2,3]; A2 := [1,2,3,4,5]; if (A1 <= A2) then {or (A2 >= A1)} writeln ('A1 is a subset of A2'); readln (i); if (i in A1) then writeln (i,' is in A1') else writeln (i,' is not in A1'); End;
  • 22. True statement A0, A1 : Set of 1..15; A : boolean; A0 := [1, 2]; A1 := [2, 4]; A0 := A0 – [77]; A := A1 >= A0; A := 1 in A0;
  • 23. Const Sets Type Digits = set of 0..9; Const HexD : set of '0'..'z‘ = ['0'..'9', 'A'..'F', 'a'..'f']; ED : Digits = [0, 2, 4, 6, 8]; Var d : Digits; Begin d := [8]; d := ED; {d=[0,2,4,6,8]} ED:=ED+[9]; ED:=d; End. +1 Error .. Fateh 3eoonk !!
  • 24. Enum Set Type Day = (sun,mon,….,sat); Name=(koko,soso,fofo,fifi); Var days: Set of Day; N:set of Name Begin Days:=[sun..sat]; N:=[KOKO,SOSO]; End.
  • 25. Read & Print Sets :
  • 26. Program Test(); Type SInt = Set of 1..150 ; SCh = Set of ‘0’..’z’; Var S1 : SInt; S2 : SCh; Slen : Integer; Begin Readln(Slen); ReadsetI(S1 , Slen); ReadsetC(S2 , Slen); PrintsetI(S1 , Slen); PrintsetC(S2 , Slen); Readln; End.
  • 27. Read Integer Sets Procedure ReadsetI (var S:SInt; L:integer) ; var i, x : integer; Begin s:=[]; For i:=1 to L do begin Read(x); S := S + [x]; end; End;
  • 28. Read Char Sets Procedure ReadsetC (var S:SCh; L:integer) ; var i, x : Char; Begin s:=[]; For i:=1 to L do begin Read(x); S := S + [x]; end; End;
  • 29. Print Integer Sets Using While Loop: Procedure PrintsetI (S : SInt) ; var I : Integer; Begin I := 0; While ( S <> []) do If (I in S) then begin Writeln(I); S := S – [I]; end; I := I + 1; End;
  • 30. Print Integer Sets Using For Loop Procedure PrintsetI (S : SI) ; var I : Integer; Begin For I:=1 to 32700 do Begin If (I in S) then Begin Writeln(I); S := S – [I]; End; If (S = []) then I := 32700; End; End;
  • 31. Exercise : يرى في يؼهذ يا إػطاء دوراخ في يادذي انرياضياخ وانهغح الإ كَهيسيح يؼطى كم طانة ػ ذُ ذسجيهه في ان ؼًهذ رقى فريذ يحصىر تي 1..100 فإرا ػه دً أ ػذد انطلاب في كم يادج لا يرجاوز 50 طانة ان طًهىب كراتح تر اَيج ػاو تاسرخذاو الاجرائياخ وان جً ىًػاخ ورنك نهقياو تان هًاو انرانيح : . 1 ذشكيم يج ىًػح نطلاب انرياضياخ ويج ىًػح نطلاب انهغح الإ كَهيسيح )إدخال ػ اُصر ان جً ىًػح ( . 2 إجراء نطثاػح ػ اُصر ان جً ىًػح . 3 إجراء لإػطاء يج ىًػح تأرقاو انطلاب ان سًجهي تان اًدذي . 4 قررخ إدارج ان ؼًهذ ذخفيض ػذد انطلاب ورنك تالاسرغ اُء ػ ػذد يحذد ي هُى يذخم ي نىحح ان فًاذيح ػهى أ يرى اخريار أرقاو انطلاب ان فًصىني تشكم ػشىائي وان طًهىب كراتح إجراء ن قُم أرقاو انطلاب ان فًصىني إنى يج ىًػح جذيذج . 5 وضغ أرقاو انطلاب ان فًصىني ض شؼاع
  • 32. Program prog2byte_team; Uses wincrt; Type students=set of 1..100; numbers=array[1..50] of 1..100; Var seng,smath : students; Procedure inputset(var s : students; m:integer); Var i,x: integer; Begin s:=[ ]; i:=0; While (i<m) do begin writeln(„input students number „); readln(x); if (x in s) then writeln(„ you input this number befor please enter another number „) else begin i:=i+1; s:=s+[x]; end; end; End; numbers of students
  • 33. Procedure printset(s :students); Var i:integer; Begin i:=1; While (s<>[ ]) do begin if (i in s) then begin write(i:5); s:=s-[ i ]; end; i:=i+1; end; writeln; End;
  • 34. Procedure bothsub(s1,s2 : students; var s3: students); Begin s3:=s1*s2; End;
  • 35. Procedure deletestd(var s,n : students); Var k,i,x ; integer; Begin n:= [ ]; Randomize; i:=0; Writeln(„enter the number you want to go throw out „); Readln(x); While (i<x) do begin k:= random(100) + 1; if ( k in s ) then begin s:=s – [ k ]; seng:= seng – [ k ]; smath:=smath – [ k ]; i:=i+1; n:=n + [ k ]; end; end; End; بلاطنا حػىًجي ان فًصىني يج ىًػح انرقاطغ :Randomize يقىو ترىنيذ أرقاو ػشىائيح أػر اًدا ػهى ساػح ان ظُاو :Random(100)=0..99; Random(100)+1=1..100
  • 36. Procedure setinArray(s: students; var a: numbers ; var k: integer); Var i : integer; Begin K:=0; For i:=1 to 100 do If (i in s) then begin k:=k+1; a[k]:=i; end; End; ي أجم اسرذػاء انشؼاع في انثر اَيج انرئيسي
  • 37. Var nmath,neng,k,i :integer; Aunaccepted : numbers; Sunaccepted,sboth : students; Begin Writeln(„enter the number of math students „); Readln(nmath); Inputset(smath,nmath); Writeln(„enter the number of English students „); Readln(neng); Inputset(seng,neng); Bothsub(smath , seng , sboth); Printset(sboth); Deletestd(sboth,Sunaccepted); Printset(Sunaccepted); setinArray(Sunaccepted,Aunaccepted,k); For i:=1 to k do Writeln(Aunaccepted[i]:5); Readln; End.
  • 38. Homework: Creat and read two arrays of student numbers, student numbers in Prog and in English. -We want to know the students numbers at the two subjects..?! -what are the student numbers at the Prog and Not at English ?? +10 point
  • 39. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 2 bytes team
  • 41. Ques: write a programme DO: 1-Read An Array 2-Print An Array//Proce 3-function to find the min elem in the array 4-Procedure to find the Sum array(of the tow arrays). 5- Multi array Write the Main Program..
  • 42. Programme P-Matrix; Const nMax=20; mMax=20; Type Matrix=array[1..nmax,1..mmax] of real; Var A,B,Add,mult :Matrix; n1,n2 :1..nmax; m1,m2 :1..mmax; min: integer;
  • 43. Procedure ReadMat(Var: n:1..nmax;var m:1..mmax; var A:matrix); Var i,j:integer; begin writeln(„enter the first Dimention of matrix< ‟ ,nmax); Readln(n); writeln(„enter the second Dimention of matrix< ‟ ,mmax); Readln(m); for i:=1 to n do begin for j:=1 to m do read(A[I,j]); {hint} readln; {hint} end; end;
  • 44. Procedure WriteMat(Var: n:1..nmax;var m:1..mmax; var A:matrix); Var i,j:integer; begin for i:=1 to n do begin for j:=1 to m do write(A[i,j],‟ ‟); writeln; end; end;
  • 45. Function MinOfMatrix(n:1..nmax,m:1..mmax;A:matrix):real Var i,j:integer; min:real; begin min:=A[1,1]; For i:=1 to n do for j:=1 to m do if (A[i,j]<min) then min:=A[i,j]; MinOfMatrix:=min; end;
  • 46. Procedure Add_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix); Var i,j:integer; begin if(n1<>n2)or(m1<>m2) then writeln(„the addition is impossible‟); else begin n3:=n1; m3:=m1; for i:=1 to n3 do for j:=1 to m3 do C[i.j]:=A[i,j]+B[i,j]; end; end;
  • 47. Procedure Mult_Tow_Matrix(n1,n2:1..nmax; m1,m2:1..mmax; var n3:1..nmax; var m3:1..mmax; var c:Matrix); Var i,j,k:integer; begin if(n1<>m2) then writeln(„the multi is impossible‟); else begin n3:=n2; m3:=m1; { A(m1,n1)*B(m2,n2)=C(m3,n3)} for i:=1 to n3 do for j:=1 to m3 do begin C[i,j]=0; for k:=1 to m2 C[i.j]:= C[i.j] +A[i,k]*B[k,j]; end; end; end;
  • 48. Begin ReadMat(n1,m1,A); WriteMat(n1,m1,A); ReadMat(n2,m2,B); WriteMat(n2,m2,B); writeln(„the minimum of the first Mat = ‟); min:=MinOfMatrix(n1,m1,A); writeln(min); Add_Tow_Matrix(n1.m1,n2,m2,A,B,n3,m3,Add); WriteMat(n3,m3,Add); Mult_Tow_Matrix(n1,n2,m1,m2,A,B, n3,m3,mult); WriteMat(n3,m3,mult); End;
  • 49. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 2 bytes team