SlideShare a Scribd company logo
Prog_2 course- 2014 
2 bytes team 
Kinan keshkeh 
IT Engineering-Damascus University 
3rd year
Record
Data Structure: 
 
Data Structure are divided into : 
Complex types 
Simple types 
Records 
•(char,integer,Boolean .... ) 
•User design type : 
•Type mytype=1.. 100 ; 
var x : mytype;
Definition 
Records are complex type which enables us to combine a set of simple variables in one Data structure named Record .... 
Example: ( car’s information ) type 
engine 
production year 
Example(2): date (year.. Month... Day)..... 
How we can define Records ?
Ex: 
• Type person=record 
fname: string ; 
lname: string; 
age: integer; 
end; 
Note : we can define a record in one of its fields 
•Type employee=record 
address: string; 
salary: real; 
per: person; 
end ;
fname 
lname 
age 
fname 
per 
salary 
address 
lname 
age
•var Emp :array[1..100] of employee 
Define variable of type record 
•Note : you can define a matrix records 
person 
employee 
•var y:employee 
•var x:person
Using records : 
Read record’s data : 
readln(x); 
Readln(y); 
{ True } 
readln(x.fname); 
readln( y.address); 
readln(y.per.age); 
{ False }
Read matrix of records 
•for i=1 to 50 do 
•begin 
readln(Emp[i].salary); readln(Emp[i].per.fname); ………………………………. ………………………………. end; 
•Var Emp : array[1..100] of employee;
Write record’s data 
{↔ writeln(y.per.fname);} 
<<<Using with >>> 
With y do Begin writeln(address); writeln(per.name); with per do begin writeln(fname); writeln(age); writeln(lname); end; end;
In matrix of records 
For i:=1 to 75 do 
with Emp[i] do 
begin 
readln(address); 
writeln(per.age); 
………………………………. ………………………………. 
end; 
salary:=50000;
Exercise : 
We have (record) of complex number : 
1.Write procedure to input this number 
2.Write procedure to print this number 
3.Write procedure to combine two numbers 
4.Write function to calculate Abs of number 
Let’s go 
....
Program prog2_bytes 
Uses wincrt 
Type complex=record 
re,Img : real; 
end; 
Procedure Inputcom(var c:complex); 
Begin 
with c do 
Begin 
writeln(‘enter the real part ‘); 
readln(re); 
writeln(‘enter the Img part ‘); 
readln(Img); 
end; 
End;
Procedure printcom( c: complex); 
Begin 
With c do 
If Img<>0 then 
Writeln(‘z= ‘,re:5:2,Img:5:2,’i’); 
Else writeln(‘z=‘,re:5:2); 
end; 
End; 
Procedure sumcom( a , b: complex ; var c:complex); 
Begin 
with c do 
begin 
re:=a.re+b.re; 
Img:=a.Img+b.Img; 
end; 
End;
Function Abscom(c : complex):real; 
Begin 
Abscom:=sqrt(sqr(c.re)+sqr(c.Img)); 
End; 
Var x,y,z:complex; 
Begin 
Inputcom(x); 
Inputcom(y); 
Sumcom(x ,y ,z ); 
Printcom(z); 
Writeln(‘|z|=‘,Abscom(z:5:2)); 
End.
Homework: 
نذ اٌُ ششكح تحىي n يىظف وان طًهىب كتاتح تش اَيج عاو 
تاستخذاو الإجشائ اٍخ وانتىاتع ورنك نهق اٍو تان هًاو انتان حٍ : 
 ادخال انث اٍ اَخ انتان حٍ ع يىظف انششكح : 
}الاسى , انشاتة , تاس خٌ انع مً , انع ىُا ان فًصم)ان ذً حٌُ , 
انشاسع , سقى انث اُء ( { 
 طثاعح ت اٍ اَخ ان ىًظف عهى شكم جذول 
 تشت ةٍ انسجلاخ تصاعذ اٌ حسة الاسى وطثاعح 
انسجلاخ ان شًتثح 
 إحانح ان ىًظف انز ع هًىا 25 س حُ تانخذيح نهتقاعذ 
يع خصى 25 % ي ساتثهى 
Additional demand for creative 
قشسخ انششكح استخذاو يىظف جذ ذٌ وان طًهىب : 
ادخال ت اٍ اَخ ان ىًظف إنى انجذول دو الأخلال تتشت ةٍ 
انسجلاخ ف هٍ ) انثحث ع ان ىًقع ان اًُسة ف انسجم يثاششج ( 
+3.5 
+2.5 
+4 
+2.5 
+2.5
Revision Practice
المطلوب كتابة إجرائية و تابع لحساب المضاعف 
المشترك الأصغر والقاسم المشترك الأكبر لعددين 
program prog_2bytesteam; 
procedure Lcm(a,b:integer; var c:integer); 
var i,L,temp : integer; 
begin 
if (a>b) then 
begin 
temp:=a; 
a:=b; 
b:=temp; 
end; 
i:=1; 
L:=a; 
while( L mod b <> 0) do 
begin 
i:=i+1; 
L:=a*i; 
end; 
c:=L; 
end;
program prog_2bytesteam; 
function Lcm(a,b:integer):integer; 
var i,L,temp:integer; 
begin 
if (a>b) then 
begin 
temp:=a; 
a:=b; 
b:=temp; 
end; 
i:=1; 
L:=a; 
while( L mod b <> 0) do 
begin 
i:=i+1; 
L:=a*i; 
end; 
Lcm:=L; 
end;
program prog_2bytesteam; 
procedure gcd(a,b:integer; var c:integer); 
begin 
while( a <> b ) do 
if (a>b) then 
a:=a-b 
else 
b:=b-a; 
c:=a; 
end;
program prog_2bytesteam; 
function gcd(a,b:integer):integer; 
begin 
while( a <> b ) do 
if (a>b) then 
a:=a-b 
else 
b:=b-a; 
gcd:=a; 
end;
Group : group link 
Mobile phone- Kinan : 0994385748 
Facebook account : kinan’s account 
2 bytes team

More Related Content

What's hot

please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...hwbloom27
 
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Tech Triveni
 
Program persamaan kuadrat
Program persamaan kuadratProgram persamaan kuadrat
Program persamaan kuadratlinda_rosalina
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystifiedJeroen Resoort
 
Presentation1
Presentation1Presentation1
Presentation1Sakura
 
A nice 64-bit error in C
A  nice 64-bit error in CA  nice 64-bit error in C
A nice 64-bit error in CPVS-Studio
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Dr. Loganathan R
 
Cosc 2425 project 2 part 1 implement the following c++ code
Cosc 2425   project 2 part 1 implement the following c++ code Cosc 2425   project 2 part 1 implement the following c++ code
Cosc 2425 project 2 part 1 implement the following c++ code AISHA232980
 
Chapter20 class-example-program
Chapter20 class-example-programChapter20 class-example-program
Chapter20 class-example-programDeepak Singh
 
Kumpulan contoh-program-pascal
Kumpulan contoh-program-pascalKumpulan contoh-program-pascal
Kumpulan contoh-program-pascalrey25
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersDr. Loganathan R
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structureRumman Ansari
 
Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder Bharti Airtel Ltd.
 

What's hot (19)

please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...
 
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
Simplified Scala Monads And Transformation - Harmeet Singh (Knoldus Inc.)
 
C++ training day01
C++ training day01C++ training day01
C++ training day01
 
Program persamaan kuadrat
Program persamaan kuadratProgram persamaan kuadrat
Program persamaan kuadrat
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystified
 
Lecture 3 c++
Lecture 3 c++Lecture 3 c++
Lecture 3 c++
 
Practical no 1
Practical no 1Practical no 1
Practical no 1
 
Presentation1
Presentation1Presentation1
Presentation1
 
A nice 64-bit error in C
A  nice 64-bit error in CA  nice 64-bit error in C
A nice 64-bit error in C
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
Cosc 2425 project 2 part 1 implement the following c++ code
Cosc 2425   project 2 part 1 implement the following c++ code Cosc 2425   project 2 part 1 implement the following c++ code
Cosc 2425 project 2 part 1 implement the following c++ code
 
Chapter20 class-example-program
Chapter20 class-example-programChapter20 class-example-program
Chapter20 class-example-program
 
Kumpulan contoh-program-pascal
Kumpulan contoh-program-pascalKumpulan contoh-program-pascal
Kumpulan contoh-program-pascal
 
VERILOG CODE FOR Adder
VERILOG CODE FOR AdderVERILOG CODE FOR Adder
VERILOG CODE FOR Adder
 
Activities on Software Development
Activities on Software DevelopmentActivities on Software Development
Activities on Software Development
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structure
 
Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder Verilog VHDL code Parallel adder
Verilog VHDL code Parallel adder
 
Code optimization
Code optimization Code optimization
Code optimization
 

Viewers also liked

Ideas principales de todos español
Ideas principales de todos españolIdeas principales de todos español
Ideas principales de todos españolPaty Rojas
 
tarea 1-medios de comunicacion
tarea 1-medios de comunicaciontarea 1-medios de comunicacion
tarea 1-medios de comunicacionSalvatore Bellemo
 
ניהול והטמעת Sap
ניהול והטמעת Sapניהול והטמעת Sap
ניהול והטמעת Sapgoldts
 
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA Operator Warnet Vast Raha
 
Micro 02. fen otipo. ld
Micro 02. fen otipo. ldMicro 02. fen otipo. ld
Micro 02. fen otipo. ldcmiglesias
 
Seattle Interactive Conference 2014 Brochure
Seattle Interactive Conference 2014 BrochureSeattle Interactive Conference 2014 Brochure
Seattle Interactive Conference 2014 Brochureweaveuser
 
тема 9 то
тема 9 тотема 9 то
тема 9 тоAnna_30
 
Regeneracion septiembre octubre 2011 num 21
Regeneracion septiembre octubre 2011 num 21Regeneracion septiembre octubre 2011 num 21
Regeneracion septiembre octubre 2011 num 21Martin Triana
 
Second life paco
Second life pacoSecond life paco
Second life pacoeljavivi_96
 
Engage with FutureGrid at XSEDE 12
Engage with FutureGrid at XSEDE 12Engage with FutureGrid at XSEDE 12
Engage with FutureGrid at XSEDE 12Barbara Ann O'Leary
 
My Discretionary Fund 16 March 2012
My Discretionary Fund 16 March 2012My Discretionary Fund 16 March 2012
My Discretionary Fund 16 March 2012Adrian Teja
 
Imágenes con microscopio y lupa
Imágenes con microscopio y lupaImágenes con microscopio y lupa
Imágenes con microscopio y lupacuartoaybescuela13
 
Du côté du cdi 21 30mars
Du côté du cdi 21 30marsDu côté du cdi 21 30mars
Du côté du cdi 21 30marsClaudie Merlet
 
להעניק להורינו כפי שהעניקו לנו
להעניק להורינו כפי שהעניקו לנולהעניק להורינו כפי שהעניקו לנו
להעניק להורינו כפי שהעניקו לנוkoby74
 
Actividad n4 algebra lineal
Actividad n4 algebra linealActividad n4 algebra lineal
Actividad n4 algebra linealAlvaroBachaco
 
Mini PC Pandora MP65D
Mini PC Pandora MP65DMini PC Pandora MP65D
Mini PC Pandora MP65Djasonlkf
 

Viewers also liked (20)

Ideas principales de todos español
Ideas principales de todos españolIdeas principales de todos español
Ideas principales de todos español
 
tarea 1-medios de comunicacion
tarea 1-medios de comunicaciontarea 1-medios de comunicacion
tarea 1-medios de comunicacion
 
ניהול והטמעת Sap
ניהול והטמעת Sapניהול והטמעת Sap
ניהול והטמעת Sap
 
Sujetos y aprendizaje
Sujetos y aprendizajeSujetos y aprendizaje
Sujetos y aprendizaje
 
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA
Mineral dan efeknya bagi kesehatan AKBID PARAMATA RAHA
 
Micro 02. fen otipo. ld
Micro 02. fen otipo. ldMicro 02. fen otipo. ld
Micro 02. fen otipo. ld
 
Cultura
CulturaCultura
Cultura
 
Seattle Interactive Conference 2014 Brochure
Seattle Interactive Conference 2014 BrochureSeattle Interactive Conference 2014 Brochure
Seattle Interactive Conference 2014 Brochure
 
тема 9 то
тема 9 тотема 9 то
тема 9 то
 
Regeneracion septiembre octubre 2011 num 21
Regeneracion septiembre octubre 2011 num 21Regeneracion septiembre octubre 2011 num 21
Regeneracion septiembre octubre 2011 num 21
 
Second life paco
Second life pacoSecond life paco
Second life paco
 
Es mejor asi
Es mejor asiEs mejor asi
Es mejor asi
 
Engage with FutureGrid at XSEDE 12
Engage with FutureGrid at XSEDE 12Engage with FutureGrid at XSEDE 12
Engage with FutureGrid at XSEDE 12
 
My Discretionary Fund 16 March 2012
My Discretionary Fund 16 March 2012My Discretionary Fund 16 March 2012
My Discretionary Fund 16 March 2012
 
Imágenes con microscopio y lupa
Imágenes con microscopio y lupaImágenes con microscopio y lupa
Imágenes con microscopio y lupa
 
Untitled presentation
Untitled presentationUntitled presentation
Untitled presentation
 
Du côté du cdi 21 30mars
Du côté du cdi 21 30marsDu côté du cdi 21 30mars
Du côté du cdi 21 30mars
 
להעניק להורינו כפי שהעניקו לנו
להעניק להורינו כפי שהעניקו לנולהעניק להורינו כפי שהעניקו לנו
להעניק להורינו כפי שהעניקו לנו
 
Actividad n4 algebra lineal
Actividad n4 algebra linealActividad n4 algebra lineal
Actividad n4 algebra lineal
 
Mini PC Pandora MP65D
Mini PC Pandora MP65DMini PC Pandora MP65D
Mini PC Pandora MP65D
 

Similar to 2Bytesprog2 course_2014_c1_sets

Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02CIMAP
 
Week 2PRG 218Variables and Input and Output OperationsWrite .docx
Week 2PRG 218Variables and Input and Output OperationsWrite .docxWeek 2PRG 218Variables and Input and Output OperationsWrite .docx
Week 2PRG 218Variables and Input and Output OperationsWrite .docxco4spmeley
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in PythonPranavSB
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxSONU KUMAR
 
Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1Ahmad Bashar Eter
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptUdhayaKumar175069
 
Survey of programming language getting started in C
Survey of programming language getting started in CSurvey of programming language getting started in C
Survey of programming language getting started in Cummeafruz
 
270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functionsray143eddie
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.pptAlefya1
 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2Tekendra Nath Yogi
 
Programming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptxProgramming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptxNoorAntakia
 

Similar to 2Bytesprog2 course_2014_c1_sets (20)

3 algorithm-and-flowchart
3 algorithm-and-flowchart3 algorithm-and-flowchart
3 algorithm-and-flowchart
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Operators
OperatorsOperators
Operators
 
Week 2PRG 218Variables and Input and Output OperationsWrite .docx
Week 2PRG 218Variables and Input and Output OperationsWrite .docxWeek 2PRG 218Variables and Input and Output OperationsWrite .docx
Week 2PRG 218Variables and Input and Output OperationsWrite .docx
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in Python
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 
Survey of programming language getting started in C
Survey of programming language getting started in CSurvey of programming language getting started in C
Survey of programming language getting started in C
 
270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions270 1 c_intro_up_to_functions
270 1 c_intro_up_to_functions
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
 
Programming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptxProgramming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptx
 

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 conceptkinan 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 conceptkinan 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_graphkinan keshkeh
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_unitskinan keshkeh
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_listskinan 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 listkinan keshkeh
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointerskinan keshkeh
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfileskinan keshkeh
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfileskinan keshkeh
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_recordskinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_setskinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_setskinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_setskinan keshkeh
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templateskinan keshkeh
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphismkinan keshkeh
 
2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritance2 BytesC++ course_2014_c11_ inheritance
2 BytesC++ course_2014_c11_ inheritancekinan 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_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
 
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
 

Recently uploaded

Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Soroosh Khodami
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignNeo4j
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfVictor Lopez
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockSkilrock Technologies
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfayushiqss
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring SoftwareMera Monitor
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzisteffenkarlsson2
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 

Recently uploaded (20)

Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
How To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdfHow To Build a Successful SaaS Design.pdf
How To Build a Successful SaaS Design.pdf
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring Software
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 

2Bytesprog2 course_2014_c1_sets

  • 1. Prog_2 course- 2014 2 bytes team Kinan keshkeh IT Engineering-Damascus University 3rd year
  • 3. Data Structure:  Data Structure are divided into : Complex types Simple types Records •(char,integer,Boolean .... ) •User design type : •Type mytype=1.. 100 ; var x : mytype;
  • 4. Definition Records are complex type which enables us to combine a set of simple variables in one Data structure named Record .... Example: ( car’s information ) type engine production year Example(2): date (year.. Month... Day)..... How we can define Records ?
  • 5. Ex: • Type person=record fname: string ; lname: string; age: integer; end; Note : we can define a record in one of its fields •Type employee=record address: string; salary: real; per: person; end ;
  • 6. fname lname age fname per salary address lname age
  • 7. •var Emp :array[1..100] of employee Define variable of type record •Note : you can define a matrix records person employee •var y:employee •var x:person
  • 8. Using records : Read record’s data : readln(x); Readln(y); { True } readln(x.fname); readln( y.address); readln(y.per.age); { False }
  • 9. Read matrix of records •for i=1 to 50 do •begin readln(Emp[i].salary); readln(Emp[i].per.fname); ………………………………. ………………………………. end; •Var Emp : array[1..100] of employee;
  • 10. Write record’s data {↔ writeln(y.per.fname);} <<<Using with >>> With y do Begin writeln(address); writeln(per.name); with per do begin writeln(fname); writeln(age); writeln(lname); end; end;
  • 11. In matrix of records For i:=1 to 75 do with Emp[i] do begin readln(address); writeln(per.age); ………………………………. ………………………………. end; salary:=50000;
  • 12. Exercise : We have (record) of complex number : 1.Write procedure to input this number 2.Write procedure to print this number 3.Write procedure to combine two numbers 4.Write function to calculate Abs of number Let’s go ....
  • 13. Program prog2_bytes Uses wincrt Type complex=record re,Img : real; end; Procedure Inputcom(var c:complex); Begin with c do Begin writeln(‘enter the real part ‘); readln(re); writeln(‘enter the Img part ‘); readln(Img); end; End;
  • 14. Procedure printcom( c: complex); Begin With c do If Img<>0 then Writeln(‘z= ‘,re:5:2,Img:5:2,’i’); Else writeln(‘z=‘,re:5:2); end; End; Procedure sumcom( a , b: complex ; var c:complex); Begin with c do begin re:=a.re+b.re; Img:=a.Img+b.Img; end; End;
  • 15. Function Abscom(c : complex):real; Begin Abscom:=sqrt(sqr(c.re)+sqr(c.Img)); End; Var x,y,z:complex; Begin Inputcom(x); Inputcom(y); Sumcom(x ,y ,z ); Printcom(z); Writeln(‘|z|=‘,Abscom(z:5:2)); End.
  • 16. Homework: نذ اٌُ ششكح تحىي n يىظف وان طًهىب كتاتح تش اَيج عاو تاستخذاو الإجشائ اٍخ وانتىاتع ورنك نهق اٍو تان هًاو انتان حٍ :  ادخال انث اٍ اَخ انتان حٍ ع يىظف انششكح : }الاسى , انشاتة , تاس خٌ انع مً , انع ىُا ان فًصم)ان ذً حٌُ , انشاسع , سقى انث اُء ( {  طثاعح ت اٍ اَخ ان ىًظف عهى شكم جذول  تشت ةٍ انسجلاخ تصاعذ اٌ حسة الاسى وطثاعح انسجلاخ ان شًتثح  إحانح ان ىًظف انز ع هًىا 25 س حُ تانخذيح نهتقاعذ يع خصى 25 % ي ساتثهى Additional demand for creative قشسخ انششكح استخذاو يىظف جذ ذٌ وان طًهىب : ادخال ت اٍ اَخ ان ىًظف إنى انجذول دو الأخلال تتشت ةٍ انسجلاخ ف هٍ ) انثحث ع ان ىًقع ان اًُسة ف انسجم يثاششج ( +3.5 +2.5 +4 +2.5 +2.5
  • 18. المطلوب كتابة إجرائية و تابع لحساب المضاعف المشترك الأصغر والقاسم المشترك الأكبر لعددين program prog_2bytesteam; procedure Lcm(a,b:integer; var c:integer); var i,L,temp : integer; begin if (a>b) then begin temp:=a; a:=b; b:=temp; end; i:=1; L:=a; while( L mod b <> 0) do begin i:=i+1; L:=a*i; end; c:=L; end;
  • 19. program prog_2bytesteam; function Lcm(a,b:integer):integer; var i,L,temp:integer; begin if (a>b) then begin temp:=a; a:=b; b:=temp; end; i:=1; L:=a; while( L mod b <> 0) do begin i:=i+1; L:=a*i; end; Lcm:=L; end;
  • 20. program prog_2bytesteam; procedure gcd(a,b:integer; var c:integer); begin while( a <> b ) do if (a>b) then a:=a-b else b:=b-a; c:=a; end;
  • 21. program prog_2bytesteam; function gcd(a,b:integer):integer; begin while( a <> b ) do if (a>b) then a:=a-b else b:=b-a; gcd:=a; end;
  • 22. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 2 bytes team