-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.cpp
54 lines (46 loc) · 1.34 KB
/
main.cpp
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
#include <iostream>
#include "SacoTAD.hpp"
#include "ListaEncadeada.hpp"
#include "SacoVetor.hpp"
int main()
{
SacoTAD s = ListaEnc1(); // alguma implementação
s.cria();
s.adiciona('c');
s.adiciona('a');
s.adiciona('b');
s.adiciona('a');
printf("%d\n", s.busca('a').terminou()); // 0
printf("%d\n", s.busca('d').terminou()); // 1
printf("%d\n", buscarec(s.itera(), 'd').terminou()); // 1
printf("N=%d\n", s.N); // N=4
for (auto it = s.itera(); !it.terminou(); it.proximo())
printf("%c\n", it.atual()); // a b a c
//
s.remove(s.busca('b'));
printf("N=%d\n", s.N); // N=3
for (auto x : s)
printf("%c\n", x); // a a c
s.libera();
printf("N=%d\n", s.N); // N=0
printf(" ====VETOR==== \n");
SacoTAD v = SacoVetor1(); // alguma implementação
v.cria();
v.adiciona('c');
v.adiciona('a');
v.adiciona('b');
v.adiciona('a');
printf("%d\n", v.busca('a').terminou()); // 0
printf("%d\n", v.busca('d').terminou()); // 1
printf("N=%d\n", v.N); // N=4
for (auto it = v.itera(); !it.terminou(); it.proximo())
printf("%c\n", it.atual()); // c a b a
//
v.remove(v.busca('b'));
printf("N=%d\n", v.N); // N=3
for (auto x : v)
printf("%c\n", x); // c a a
v.libera();
printf("N=%d\n", v.N); // N=0
return 0;
}