SlideShare a Scribd company logo
1 of 3
Download to read offline
28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas
1: //ELAINE CECÍLIA GATTO
2: //27/08/2016
3:
4: program fila_exemplo;
5: uses wincrt, crt;
6:
7: const max=50;
8:
9: type
10: elem = char;
11: fila = record
12: inicio : integer;
13: final : integer;
14: memo: array[1..max] of elem;
15: end;
16:
17: var
18: f : fila;
19: a : elem;
20: opcao : integer;
21: b : boolean;
22: i : integer;
23:
24: //INICIALIZA A FILA
25: procedure Init(var f:fila);
26: begin
27: f.inicio := 1;
28: f.final := 1;
29: end;
30:
31: //VERIRICA SE A FILA ESTÁ VAZIA
32: function isEmpty(var f:fila):boolean;
33: begin
34: isEmpty := (f.inicio = f.final);
35: end;
36:
37: //VERIFICA SE A FILA ESTÁ CHEIA
38: function isFull(var f:fila):boolean;
39: begin
40: isFull := (f.final > max);
41: end;
42:
43: //IMPRIME A FILA
44: procedure imprimir(var f:fila);
45: begin
46: writeln( ' inicio da fila: ' , f.inicio );
47: writeln( ' final da fila: ' , f.final );
48: writeln( ' valores da fila: ', f.memo);
49: end;
50:
51: //INSERE NA FILA
52: procedure enQueue(var f:fila; x:elem);
53: begin
54: if not isFull(f) then
55: begin
56: f.memo[f.final]:=x;
57: f.final:=f.final+1;
58: end
59: else begin
60: writeln(' FILA VAZIA ');
61: end;
62: end;
63:
64: //REMOVE DA FILA
65: function deQueue(var f: fila):elem;
66: begin
1/3
28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas
67: if not isEmpty(f) then
68: begin
69: deQueue:= f.memo[f.inicio];
70: f.inicio := f.inicio + 1;
71: end
72: else begin
73: writeln(' FILA VAZIA ');
74: end;
75: end;
76:
77: //MENU
78: procedure menu;
79: begin
80:
81: repeat
82: writeln(' MENU ');
83: writeln (' 1. Remover na Fila');
84: writeln (' 2. Inserir da Fila ');
85: writeln (' 3. Verificar se a Fila esta Cheia');
86: writeln (' 4. Verificar se a Fila esta Vazia');
87: writeln (' 5. Iniciar a Fila ');
88: writeln (' 6. Imprimir a Fila ');
89: writeln (' 0. SAIR ');
90: writeln('');
91: write(' Digite a opcao desejada: ');
92: readln(opcao);
93: writeln('');
94:
95: Case opcao Of
96: 1 : Begin
97: a:=deQueue(f);
98: writeln(' Removendo: ', a);
99: writeln('');
100: end;
101:
102: 2 : Begin
103: write(' Inserindo: ');
104: readln(a);
105: enQueue(f,a);
106: writeln('');
107: end;
108:
109: 3 : Begin
110: b:=isFull(f);
111: if(b=true)then begin
112: writeln('Fila Cheia');
113: end
114: else begin
115: writeln(' Fila nao Cheia');
116: end;
117: writeln('');
118: end;
119:
120: 4 : Begin
121: b:=isEmpty(f);
122: if(b=true)then begin
123: writeln('Fila Vazia');
124: end
125: else begin
126: writeln(' Fila nao Vazia');
127: end;
128: writeln('');
129: end;
130:
131: 5 : Begin
132: init(f);
2/3
28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas
133: writeln('');
134: end;
135: 6 : Begin
136: imprimir(f);
137: writeln('');
138: end;
139: Else writeln (' invalido ');
140: End;
141: until opcao = 0;
142: writeln('');
143: end;
144:
145: //PROGRAMA PRINCIPAL
146: begin
147: menu();
148: end.
3/3

More Related Content

What's hot

Triggers-Sequences-SQL
Triggers-Sequences-SQLTriggers-Sequences-SQL
Triggers-Sequences-SQL
Patrick Seery
 

What's hot (20)

Codigo
CodigoCodigo
Codigo
 
Alu all shift register
Alu all shift registerAlu all shift register
Alu all shift register
 
week-2x
week-2xweek-2x
week-2x
 
Tu1
Tu1Tu1
Tu1
 
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
PHP「参照渡しできるよ」(君の考えている参照渡しと同じとは言ってない)
 
Valgrind tool
Valgrind toolValgrind tool
Valgrind tool
 
Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015
 
Torchbearersnotebook.blogspot.com program to create a list in python and valu...
Torchbearersnotebook.blogspot.com program to create a list in python and valu...Torchbearersnotebook.blogspot.com program to create a list in python and valu...
Torchbearersnotebook.blogspot.com program to create a list in python and valu...
 
Stack using Array
Stack using ArrayStack using Array
Stack using Array
 
Triggers-Sequences-SQL
Triggers-Sequences-SQLTriggers-Sequences-SQL
Triggers-Sequences-SQL
 
05 1 수식과 연산자
05 1 수식과 연산자05 1 수식과 연산자
05 1 수식과 연산자
 
C programming BY Mazedur
C programming BY MazedurC programming BY Mazedur
C programming BY Mazedur
 
Week 7
Week 7Week 7
Week 7
 
Александр Трищенко: PHP 7 Evolution
Александр Трищенко: PHP 7 EvolutionАлександр Трищенко: PHP 7 Evolution
Александр Трищенко: PHP 7 Evolution
 
Javascript: Conceptos básicos
Javascript: Conceptos básicosJavascript: Conceptos básicos
Javascript: Conceptos básicos
 
Criando tabelas
Criando tabelasCriando tabelas
Criando tabelas
 
Generators
GeneratorsGenerators
Generators
 
Comandos excel
Comandos excelComandos excel
Comandos excel
 
Sample1
Sample1Sample1
Sample1
 
Week7
Week7Week7
Week7
 

Viewers also liked (12)

Pilha de caracteres
Pilha de caracteresPilha de caracteres
Pilha de caracteres
 
Lista sequencial estatica
Lista sequencial estaticaLista sequencial estatica
Lista sequencial estatica
 
Lista simplesmente encadeada dinamica
Lista simplesmente encadeada dinamicaLista simplesmente encadeada dinamica
Lista simplesmente encadeada dinamica
 
Lista duplamente encadeada dinamica
Lista duplamente encadeada dinamicaLista duplamente encadeada dinamica
Lista duplamente encadeada dinamica
 
Insertion Sort Classe Principal
Insertion Sort Classe PrincipalInsertion Sort Classe Principal
Insertion Sort Classe Principal
 
Buble Sort Classe principal
Buble Sort Classe principalBuble Sort Classe principal
Buble Sort Classe principal
 
Insertion Sort Classe Java
Insertion Sort Classe JavaInsertion Sort Classe Java
Insertion Sort Classe Java
 
Algoritmos: Variáveis e Constantes
Algoritmos: Variáveis e ConstantesAlgoritmos: Variáveis e Constantes
Algoritmos: Variáveis e Constantes
 
Algoritmos: Tipos de Dados
Algoritmos: Tipos de DadosAlgoritmos: Tipos de Dados
Algoritmos: Tipos de Dados
 
Arvore binária
Arvore bináriaArvore binária
Arvore binária
 
Lista duplamente encadeada dinâmica circular
Lista duplamente encadeada dinâmica circularLista duplamente encadeada dinâmica circular
Lista duplamente encadeada dinâmica circular
 
Lista simplesmente encadeada dinâmica circular
Lista simplesmente encadeada dinâmica circularLista simplesmente encadeada dinâmica circular
Lista simplesmente encadeada dinâmica circular
 

Similar to Fila de caracteres

C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdf
flashfashioncasualwe
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovin
Adri Jovin
 
You work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docxYou work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docx
rosemarybdodson23141
 
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docxlogfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
smile790243
 

Similar to Fila de caracteres (20)

ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชันตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
ตัวอย่างการเขียนโปรแกรม โดยใช้ฟังก์ชัน
 
Csphtp1 07
Csphtp1 07Csphtp1 07
Csphtp1 07
 
C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdf
 
Bubble and selection
Bubble and selectionBubble and selection
Bubble and selection
 
Pl sql programme
Pl sql programmePl sql programme
Pl sql programme
 
Pl sql programme
Pl sql programmePl sql programme
Pl sql programme
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovin
 
Wildlife conservation project management adri jovin
Wildlife conservation project management  adri jovinWildlife conservation project management  adri jovin
Wildlife conservation project management adri jovin
 
C Programming Lab.pdf
C Programming Lab.pdfC Programming Lab.pdf
C Programming Lab.pdf
 
You work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docxYou work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docx
 
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docxlogfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
logfile.logNOTE Copyright (c) 2002-2012 by SAS Institute Inc..docx
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
2016年のPerl (Long version)
2016年のPerl (Long version)2016年のPerl (Long version)
2016年のPerl (Long version)
 
Csphtp1 05
Csphtp1 05Csphtp1 05
Csphtp1 05
 
C lab-programs
C lab-programsC lab-programs
C lab-programs
 
10 Catalyst Tips
10 Catalyst Tips10 Catalyst Tips
10 Catalyst Tips
 
Fatima Aliasgher Portfolio
Fatima Aliasgher PortfolioFatima Aliasgher Portfolio
Fatima Aliasgher Portfolio
 
Es6 overview
Es6 overviewEs6 overview
Es6 overview
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
 
JavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooJavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring Roo
 

More from Elaine Cecília Gatto

More from Elaine Cecília Gatto (20)

A influência da Tecnologia em cada faixa etaria
A influência da Tecnologia em cada faixa etariaA influência da Tecnologia em cada faixa etaria
A influência da Tecnologia em cada faixa etaria
 
Inteligência Artificial Aplicada à Medicina
Inteligência Artificial Aplicada à MedicinaInteligência Artificial Aplicada à Medicina
Inteligência Artificial Aplicada à Medicina
 
Além do Aprendizado Local e Global: Particionando o espaço de classes em prob...
Além do Aprendizado Local e Global: Particionando o espaço de classes em prob...Além do Aprendizado Local e Global: Particionando o espaço de classes em prob...
Além do Aprendizado Local e Global: Particionando o espaço de classes em prob...
 
Apresentação da minha tese de doutorado no EPPC
Apresentação da minha tese de doutorado no EPPCApresentação da minha tese de doutorado no EPPC
Apresentação da minha tese de doutorado no EPPC
 
entrevista r7.pdf
entrevista r7.pdfentrevista r7.pdf
entrevista r7.pdf
 
Como a pesquisa científica impacta o mundo real.pptx
Como a pesquisa científica impacta o mundo real.pptxComo a pesquisa científica impacta o mundo real.pptx
Como a pesquisa científica impacta o mundo real.pptx
 
Empoderamento Feminino
Empoderamento FemininoEmpoderamento Feminino
Empoderamento Feminino
 
Explorando correlações entre rótulos para o particionamento do espaço de rótu...
Explorando correlações entre rótulos para o particionamento do espaço de rótu...Explorando correlações entre rótulos para o particionamento do espaço de rótu...
Explorando correlações entre rótulos para o particionamento do espaço de rótu...
 
Community Detection for Multi-Label Classification - Seminários UFSCar
Community Detection for Multi-Label Classification - Seminários UFSCarCommunity Detection for Multi-Label Classification - Seminários UFSCar
Community Detection for Multi-Label Classification - Seminários UFSCar
 
Classificação Multirrótulo: Aprendizado de Correlações
Classificação Multirrótulo: Aprendizado de CorrelaçõesClassificação Multirrótulo: Aprendizado de Correlações
Classificação Multirrótulo: Aprendizado de Correlações
 
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
 
Community Detection Method for Multi-Label Classification
Community Detection Method for Multi-Label ClassificationCommunity Detection Method for Multi-Label Classification
Community Detection Method for Multi-Label Classification
 
Mulheres na Campus Party assumir o feminismo ou não – Blogueiras Feministas.pdf
Mulheres na Campus Party assumir o feminismo ou não – Blogueiras Feministas.pdfMulheres na Campus Party assumir o feminismo ou não – Blogueiras Feministas.pdf
Mulheres na Campus Party assumir o feminismo ou não – Blogueiras Feministas.pdf
 
Curtinhas de sábado.pdf
Curtinhas de sábado.pdfCurtinhas de sábado.pdf
Curtinhas de sábado.pdf
 
Explorando Correlações entre Rótulos usando Métodos de Detecção de Comu...
Explorando Correlações entre Rótulos usando Métodos de Detecção de Comu...Explorando Correlações entre Rótulos usando Métodos de Detecção de Comu...
Explorando Correlações entre Rótulos usando Métodos de Detecção de Comu...
 
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
EXPLORANDO CORRELAÇÕES PARA O PARTICIONAMENTO DO ESPAÇO DE RÓTULOS EM PROBLEM...
 
Pipeline desdobramento escalonamento
Pipeline desdobramento escalonamentoPipeline desdobramento escalonamento
Pipeline desdobramento escalonamento
 
Cheat sheet Mips 32 bits
Cheat sheet Mips 32 bitsCheat sheet Mips 32 bits
Cheat sheet Mips 32 bits
 
Resumo das Instruções de Desvio Incondicionais MIPS 32 bits
Resumo das Instruções de Desvio Incondicionais MIPS 32 bitsResumo das Instruções de Desvio Incondicionais MIPS 32 bits
Resumo das Instruções de Desvio Incondicionais MIPS 32 bits
 
Como descobrir e classificar coisas usando machine learning sem compilcação
Como descobrir e classificar coisas usando machine learning sem compilcaçãoComo descobrir e classificar coisas usando machine learning sem compilcação
Como descobrir e classificar coisas usando machine learning sem compilcação
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

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Ă...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

Fila de caracteres

  • 1. 28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas 1: //ELAINE CECÍLIA GATTO 2: //27/08/2016 3: 4: program fila_exemplo; 5: uses wincrt, crt; 6: 7: const max=50; 8: 9: type 10: elem = char; 11: fila = record 12: inicio : integer; 13: final : integer; 14: memo: array[1..max] of elem; 15: end; 16: 17: var 18: f : fila; 19: a : elem; 20: opcao : integer; 21: b : boolean; 22: i : integer; 23: 24: //INICIALIZA A FILA 25: procedure Init(var f:fila); 26: begin 27: f.inicio := 1; 28: f.final := 1; 29: end; 30: 31: //VERIRICA SE A FILA ESTÁ VAZIA 32: function isEmpty(var f:fila):boolean; 33: begin 34: isEmpty := (f.inicio = f.final); 35: end; 36: 37: //VERIFICA SE A FILA ESTÁ CHEIA 38: function isFull(var f:fila):boolean; 39: begin 40: isFull := (f.final > max); 41: end; 42: 43: //IMPRIME A FILA 44: procedure imprimir(var f:fila); 45: begin 46: writeln( ' inicio da fila: ' , f.inicio ); 47: writeln( ' final da fila: ' , f.final ); 48: writeln( ' valores da fila: ', f.memo); 49: end; 50: 51: //INSERE NA FILA 52: procedure enQueue(var f:fila; x:elem); 53: begin 54: if not isFull(f) then 55: begin 56: f.memo[f.final]:=x; 57: f.final:=f.final+1; 58: end 59: else begin 60: writeln(' FILA VAZIA '); 61: end; 62: end; 63: 64: //REMOVE DA FILA 65: function deQueue(var f: fila):elem; 66: begin 1/3
  • 2. 28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas 67: if not isEmpty(f) then 68: begin 69: deQueue:= f.memo[f.inicio]; 70: f.inicio := f.inicio + 1; 71: end 72: else begin 73: writeln(' FILA VAZIA '); 74: end; 75: end; 76: 77: //MENU 78: procedure menu; 79: begin 80: 81: repeat 82: writeln(' MENU '); 83: writeln (' 1. Remover na Fila'); 84: writeln (' 2. Inserir da Fila '); 85: writeln (' 3. Verificar se a Fila esta Cheia'); 86: writeln (' 4. Verificar se a Fila esta Vazia'); 87: writeln (' 5. Iniciar a Fila '); 88: writeln (' 6. Imprimir a Fila '); 89: writeln (' 0. SAIR '); 90: writeln(''); 91: write(' Digite a opcao desejada: '); 92: readln(opcao); 93: writeln(''); 94: 95: Case opcao Of 96: 1 : Begin 97: a:=deQueue(f); 98: writeln(' Removendo: ', a); 99: writeln(''); 100: end; 101: 102: 2 : Begin 103: write(' Inserindo: '); 104: readln(a); 105: enQueue(f,a); 106: writeln(''); 107: end; 108: 109: 3 : Begin 110: b:=isFull(f); 111: if(b=true)then begin 112: writeln('Fila Cheia'); 113: end 114: else begin 115: writeln(' Fila nao Cheia'); 116: end; 117: writeln(''); 118: end; 119: 120: 4 : Begin 121: b:=isEmpty(f); 122: if(b=true)then begin 123: writeln('Fila Vazia'); 124: end 125: else begin 126: writeln(' Fila nao Vazia'); 127: end; 128: writeln(''); 129: end; 130: 131: 5 : Begin 132: init(f); 2/3
  • 3. 28/08/2016 11:27:15C:UserselainDocumentsAlgoritmosFilafila.pas 133: writeln(''); 134: end; 135: 6 : Begin 136: imprimir(f); 137: writeln(''); 138: end; 139: Else writeln (' invalido '); 140: End; 141: until opcao = 0; 142: writeln(''); 143: end; 144: 145: //PROGRAMA PRINCIPAL 146: begin 147: menu(); 148: end. 3/3