forked from louis33/Lista-4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQuestao 3
64 lines (40 loc) · 830 Bytes
/
Questao 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdio.h>
#include <stdlib.h>
#define max 100
tupedef struct{
string nome;
int CPF;
}Cliente;
Typedef struct{
Cliente pilhaElementos[max];
int topo;
}TPilha
void inicializarPilha(TPilha* pilha){
TPilha->topo = -1;
}
void inserirElemento(TPilha* pilha, Cliente c1){
if(pilha->topo < 99){
pilha->topo = pilha->topo + 1;
pilha->pilhaElementos[pilha->topo] = c1;
}
else{
printf("pilha cheia");
}
Cliente removerElemento(TPilha* pilha){
if(pilha->topo >= 0){
Cliente a = pilha->topo;
pilha->topo = pilha->topo - 1;
return a;
}
else{
printf("A pilha esta vazia");
}
}
int main()
{
Cliente c1;
TPilha a;
inicializarPilha(&a);
iserirElemento(&a,c1);
removerElemento(&a);
}