SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante 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
 

Semelhante 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
 

Mais de kinan keshkeh

Mais 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

Último (20)

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
 
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
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
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
 
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 🔝✔️✔️
 
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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
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 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
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
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
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
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 

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