SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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.
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Kürzlich hochgeladen (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 

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