SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 
Chapter20 class-example-program
Chapter20 class-example-programChapter20 class-example-program
Chapter20 class-example-program
Deepak Singh
 
Kumpulan contoh-program-pascal
Kumpulan contoh-program-pascalKumpulan contoh-program-pascal
Kumpulan contoh-program-pascal
rey25
 

La actualidad más candente (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
 

Similar a 2Bytesprog2 course_2014_c2_records

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
co4spmeley
 

Similar a 2Bytesprog2 course_2014_c2_records (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
 

Más de kinan keshkeh

Más de 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_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
 
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
 

Último

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
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
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 

2Bytesprog2 course_2014_c2_records

  • 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