-
Notifications
You must be signed in to change notification settings - Fork 0
/
projeto.c
130 lines (117 loc) · 3.47 KB
/
projeto.c
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
//#include <random>
//#include <algorithm>
//#include <iterator>
#define CLEAR "CLS"
void CadastrarValores()
{
}
//template<typename RandomIt, typename Gen>
//void Desordenar(RandomIt first, RandomIt last, Gen&& g)
{
using diff_t = typename std::iterator_traits<RandomIt>::difference_type;
using distr_t = std::uniform_int_distribution<diff_t>;
using param_t = typename distr_t::param_type;
distr_t D;
diff_t n = last - first;
for (diff_t i = n-1; i > 0; --i)
{
using std::swap;
swap(first[i], first[D(g, param_t(0, i))]);
}
}
void Imprimir()
{
}
void insertionSort(int x[], int n)
{
int i, k, aux;
for (k = 1; k < n; k++)
{
aux = x[k];
for (i = k - 1; i >= 0 && aux < x[i]; i--)
{
x[i + 1] = x[i];
}
x[i + 1] = aux;
}
}
void ShellSort()
{
}
void imprimeMenu()
{
printf("+---------------------------------------------------------------+\n");
printf("|===============================================================|\n");
printf("| Programa para Matricula de aluno usando mutilista |\n");
printf("|===============================================================|\n");
printf("| Operacoes: |\n");
printf("| 1) Cadastrar valores |\n");
printf("| 2) Desordenar |\n");
printf("| 3) Imprimir |\n");
printf("| 4) InsertionSort |\n");
printf("| 5) ShellSort |\n");
printf("| 6) |\n");
printf("| 7) |\n");
printf("| 8) |\n");
printf("| 9) Sair |\n");
printf("+---------------------------------------------------------------+\n");
printf(" Pressione a opcao desejada ");
}
int main()
{
caluno caba;
caba.quant = 0;
caba.ini = NULL;
cdisciplina cabd;
cabd.quant = 0;
cabd.ini = NULL;
int ok = 1;
char opcao = '0';
while(ok)
{
system(CLEAR);
imprimeMenu();
opcao = getch();
switch(opcao)
{
case '1':
cadastrarAluno(&caba);
break;
case '2':
Desordenar();
break;
case '3':
matricularAluno(&caba, &cabd);
break;
case '4':
removerAluno(&caba);
break;
case '5':
listarAlunos(&caba);
break;
case '6':
listarDisciplinas(&cabd);
break;
case '7':
listarDisciplinasMatriculadas(&caba);
break;
case '8':
listarAlunosMatriculados(&caba, &cabd);
break;
case '9':
ok = 0;
printf("\n ¯\(°_o)/¯ \n");
break;
default:
printf("\nOpcao invalida!\n");
getch();
break;
}
}
printf("\n");
return (EXIT_SUCCESS);
}