-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
110 lines (100 loc) · 2.22 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
--------------------
| Simple Linked List |
--------------------
IDE: Microsoft® Visual Studio®
Version: 16.9.31105.61
Developer: Lucas Marra Rebello
Contact: [email protected]
Last modified: 07/05/2021 - 09:07 pm
*/
#include <iostream>
#include <stdlib.h>
#include "linkedlist.h"
#include "node.h"
using namespace std;
int main() {
LinkedList LL1;
int opt;
char Char[6] = { 218,196,191,179,192,217 };
do{
for (int i = 0; i < 33; i++) {
switch (i) {
case 0:
cout << Char[0];
break;
case 32:
cout << Char[2];
break;
default:
cout << Char[1];
}
}
cout << "\n"<< Char[3] << " SIMPLE LINKED LIST " << Char[3] << "\n";
for (int i = 0; i < 33; i++) {
switch (i) {
case 0:
cout << Char[4];
break;
case 32:
cout << Char[5];
break;
default:
cout << Char[1];
}
}
cout << "\n Escolha uma das op\207\344es abaixo:\n\n";
cout << " 0 - Sair";
cout << "\n 1 - Inserir valor na lista.";
cout << "\n 2 - Remover valor da lista.";
cout << "\n\n Digite a op\207\306o escolhida: ";
cin >> opt;
switch(opt){
case 0:
cout << "\n At\202 logo\n\n";
break;
case 1:
cout << "\n\n Digite onde deseja inserir o valor (0 = in\241cio, 1 = fim): ";
int opc;
cin >> opc;
if (opc == 0){
cout << "\n\n Digite o valor que deseja inserir: ";
int val;
cin >> val;
system("CLS");
LL1.insertBegin(LL1.createNode(val));
LL1.print();
}
else if(opc == 1){
cout << "\n\n Digite o valor que deseja inserir: ";
int val;
cin >> val;
system("CLS");
LL1.insertEnd(LL1.createNode(val));
LL1.print();
}
else {
system("CLS");
cout << "\n Op\207\306o inv\240lida !\n\n";
}
break;
case 2:
if (LL1.empty()) {
system("CLS");
cout << "\n A lista j\240 est\240 vazia !\n\n";
break;
}
cout << "\n\n Digite o valor que deseja remover: ";
int val;
cin >> val;
system("CLS");
LL1.remove(val);
LL1.print();
break;
default:
system("CLS");
cout << "\n Op\207\306o inv\240lida!\n\n";
break;
}
}while(opt != 0);
}