SlideShare a Scribd company logo
1 of 10
Download to read offline
Pascal Programming Language
Omar ElSabek & Fayez Ghazzawi
IT Engineering
3th year – UNKNOWN Department
programming II
Sets
Record
Files (Text & Binary)
Pointers
Linked Lists
Unit
Course Index :
So the STACK is:
An Abstract Structure based on the principle (LIFO) “Last in
First out”.
Thinking Of MAKDOOS right now :P :P :P :P .
It has two elements:
1. TheVariable(s) with Data type(s) “the same with all the
stacks elements”.
2. The References which refers to the next element in the
Stack (it refers to the element underneath).
This Reference has the value of (nil) in the Bottom of the
Stack.
3. The Stack has the (Top) which refers to the top element in
the Stack ….This is the reference we have keep :D.
Program test1;
Type
n_stack = ^stack;
stack = record
c : char;
next : n_stack;
end;
Now let’s meet with PUSH & POP
as Procedures :P
Procedure Push (var top: n_stack ; ch: char)
Var
temp : n_stack;
Begin
new(temp);
temp^.c := ch;
temp^.next := top;
top := temp;
End;
Procedure Pop (var top: n_stack ;var ch: char)
Var
temp : n_stack;
Begin
ch := top^.c;
temp := top;
top := top^.next;
dispose (temp);
End;
Var
s : string[10]; ch:char;
top : n_stack;
Begin
top := nil;
read(s);
for i:=1 to 10 do
Push(top,S[i]);
while (top <> nil) do
begin
Pop(top,ch); write(ch);
end;
End.
Stack c6

More Related Content

What's hot

Clojure - Revenge of the Verbs
Clojure - Revenge of the VerbsClojure - Revenge of the Verbs
Clojure - Revenge of the Verbs
Tim Lossen
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queues
tech4us
 

What's hot (19)

linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
Tools for reading papers
Tools for reading papersTools for reading papers
Tools for reading papers
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
Stacks in data structure
Stacks  in data structureStacks  in data structure
Stacks in data structure
 
Clojure - Revenge of the Verbs
Clojure - Revenge of the VerbsClojure - Revenge of the Verbs
Clojure - Revenge of the Verbs
 
Stacks & Queues
Stacks & QueuesStacks & Queues
Stacks & Queues
 
Rana Junaid Rasheed
Rana Junaid RasheedRana Junaid Rasheed
Rana Junaid Rasheed
 
Getting Started with R
Getting Started with RGetting Started with R
Getting Started with R
 
Ds lists
Ds listsDs lists
Ds lists
 
COMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesCOMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercises
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Data Structure Using C
Data Structure Using CData Structure Using C
Data Structure Using C
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
 
Data Structures 01
Data Structures 01Data Structures 01
Data Structures 01
 
C programming
C programmingC programming
C programming
 
2 a stacks
2 a stacks2 a stacks
2 a stacks
 
Rbootcamp Day 1
Rbootcamp Day 1Rbootcamp Day 1
Rbootcamp Day 1
 
Linked lists
Linked listsLinked lists
Linked lists
 

Viewers also liked

Input and output in c
Input and output in cInput and output in c
Input and output in c
Rachana Joshi
 
Pascal Programming Session 1
Pascal Programming Session 1Pascal Programming Session 1
Pascal Programming Session 1
Ashesh R
 

Viewers also liked (8)

Files c4
Files c4Files c4
Files c4
 
Turbo pascal
Turbo pascalTurbo pascal
Turbo pascal
 
Python
PythonPython
Python
 
Input and output in c
Input and output in cInput and output in c
Input and output in c
 
Pascal Programming Session 1
Pascal Programming Session 1Pascal Programming Session 1
Pascal Programming Session 1
 
Pascal programming language
Pascal programming languagePascal programming language
Pascal programming language
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
How to Use Social Media to Influence the World
How to Use Social Media to Influence the WorldHow to Use Social Media to Influence the World
How to Use Social Media to Influence the World
 

Similar to Stack c6

Stack linked list
Stack linked listStack linked list
Stack linked list
bhargav0077
 
QUESTION If you look at the code, youll see that we keep two list.pdf
QUESTION If you look at the code, youll see that we keep two list.pdfQUESTION If you look at the code, youll see that we keep two list.pdf
QUESTION If you look at the code, youll see that we keep two list.pdf
manjan6
 
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
C++ Program It is only 1 rotation. Up-rotation of a stack.  Write a.pdfC++ Program It is only 1 rotation. Up-rotation of a stack.  Write a.pdf
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
pallavi953613
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
aromalcom
 

Similar to Stack c6 (20)

Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 
Chapter 6 ds
Chapter 6 dsChapter 6 ds
Chapter 6 ds
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
 
stack.ppt
stack.pptstack.ppt
stack.ppt
 
Stack linked list
Stack linked listStack linked list
Stack linked list
 
Revised Data Structure- STACK in Python XII CS.pdf
Revised Data Structure- STACK in Python XII CS.pdfRevised Data Structure- STACK in Python XII CS.pdf
Revised Data Structure- STACK in Python XII CS.pdf
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
01-intro_stacks.ppt
01-intro_stacks.ppt01-intro_stacks.ppt
01-intro_stacks.ppt
 
QUESTION If you look at the code, youll see that we keep two list.pdf
QUESTION If you look at the code, youll see that we keep two list.pdfQUESTION If you look at the code, youll see that we keep two list.pdf
QUESTION If you look at the code, youll see that we keep two list.pdf
 
Tackling repetitive tasks with serial or parallel programming in R
Tackling repetitive tasks with serial or parallel programming in RTackling repetitive tasks with serial or parallel programming in R
Tackling repetitive tasks with serial or parallel programming in R
 
Stack & queue
Stack & queueStack & queue
Stack & queue
 
Intro to Functional Reactive Programming In Scala
Intro to Functional Reactive Programming In ScalaIntro to Functional Reactive Programming In Scala
Intro to Functional Reactive Programming In Scala
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
 
Deliverable Length  2 pseudo codesAPA format with references
Deliverable Length  2 pseudo codesAPA format with referencesDeliverable Length  2 pseudo codesAPA format with references
Deliverable Length  2 pseudo codesAPA format with references
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
Module IV_updated(old).pdf
Module IV_updated(old).pdfModule IV_updated(old).pdf
Module IV_updated(old).pdf
 
L1 - Recap.pdf
L1 - Recap.pdfL1 - Recap.pdf
L1 - Recap.pdf
 
Stack
StackStack
Stack
 
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
C++ Program It is only 1 rotation. Up-rotation of a stack.  Write a.pdfC++ Program It is only 1 rotation. Up-rotation of a stack.  Write a.pdf
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
 

More from Omar Al-Sabek (15)

Google Big Table
Google Big TableGoogle Big Table
Google Big Table
 
Online Certificate Data Mining with Weka
Online Certificate Data Mining with WekaOnline Certificate Data Mining with Weka
Online Certificate Data Mining with Weka
 
Agile Methodology
Agile MethodologyAgile Methodology
Agile Methodology
 
Git
GitGit
Git
 
E payment Project Demo
E payment Project DemoE payment Project Demo
E payment Project Demo
 
A petri-net
A petri-netA petri-net
A petri-net
 
Sets c1
Sets c1Sets c1
Sets c1
 
Records c2
Records c2Records c2
Records c2
 
Files c3
Files c3Files c3
Files c3
 
Pointers c5
Pointers c5Pointers c5
Pointers c5
 
Double linked list c8
Double linked list c8Double linked list c8
Double linked list c8
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
 
Control structures c2 c3
Control structures c2 c3Control structures c2 c3
Control structures c2 c3
 
Programming paradigms c1
Programming paradigms c1Programming paradigms c1
Programming paradigms c1
 
Arrays c4 c5
Arrays c4 c5Arrays c4 c5
Arrays c4 c5
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 

Stack c6

  • 1. Pascal Programming Language Omar ElSabek & Fayez Ghazzawi IT Engineering 3th year – UNKNOWN Department programming II
  • 2. Sets Record Files (Text & Binary) Pointers Linked Lists Unit Course Index :
  • 3.
  • 4. So the STACK is: An Abstract Structure based on the principle (LIFO) “Last in First out”. Thinking Of MAKDOOS right now :P :P :P :P .
  • 5. It has two elements: 1. TheVariable(s) with Data type(s) “the same with all the stacks elements”. 2. The References which refers to the next element in the Stack (it refers to the element underneath). This Reference has the value of (nil) in the Bottom of the Stack. 3. The Stack has the (Top) which refers to the top element in the Stack ….This is the reference we have keep :D.
  • 6. Program test1; Type n_stack = ^stack; stack = record c : char; next : n_stack; end; Now let’s meet with PUSH & POP as Procedures :P
  • 7. Procedure Push (var top: n_stack ; ch: char) Var temp : n_stack; Begin new(temp); temp^.c := ch; temp^.next := top; top := temp; End;
  • 8. Procedure Pop (var top: n_stack ;var ch: char) Var temp : n_stack; Begin ch := top^.c; temp := top; top := top^.next; dispose (temp); End;
  • 9. Var s : string[10]; ch:char; top : n_stack; Begin top := nil; read(s); for i:=1 to 10 do Push(top,S[i]); while (top <> nil) do begin Pop(top,ch); write(ch); end; End.