-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
88 lines (77 loc) · 2.5 KB
/
main.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
#include <stdio.h>
#include "sistema.h"
#include "lotes.h"
#include "menu.h"
void imprimir_curso(Curso *c) {
if(c == NULL) {
printf("Estrutura vazia.\n");
return;
}
printf("****** CURSO ********\n");
printf("Codigo: %d\n"
"Nome: %s\n"
"Area: %c\n\n"
, c->codigo, c->nome, c->area);
}
void imprimir_disciplina(Disciplina *d) {
if(d == NULL) {
printf("Estrutura vazia.\n");
return;
}
printf("******** DISCIPLINA *********\n");
printf("Codigo: %d\n"
"Nome: %s\n"
"Codigo do Curso: %d\n"
"Serie: %d\n\n"
, d->codigo, d->nome, d->codcurso, d->serie);
}
void imprimir_professor(CadastroProfessor *cp) {
if(cp == NULL) {
printf("Estrutura vazia.\n");
return;
}
printf("******** PROFESSOR *********\n");
printf("Codigo: %d\n"
"Nome: %s\n\n"
, cp->codigo, cp->nome);
}
void imprimir_distribuicao_disciplina(CadastroProfessorDisciplina *cpd) {
if(cpd == NULL) {
printf("Estrutura vazia.\n");
return;
}
printf("******** DISTRIBUICAO DE DISCIPLINA *********\n");
printf("Codigo: %d\n"
"Codigo da Disciplina: %d\n"
"Ano Letivo: %d\n"
"Codigo do Professor: %d\n"
"Codigo do Curso: %d\n\n"
, cpd->codigo, cpd->coddisciplina, cpd->anoletivo, cpd->codprofessor, cpd->codcurso);
}
void resetar() {
FILE *arq_disciplinas = fopen("disciplinas.bin", "w+b");
FILE *arq_cursos = fopen("cursos.bin", "w+b");
FILE *arq_professores = fopen("professores.bin", "w+b");
FILE *arq_professores_disciplinas = fopen("professores_disciplinas.bin", "w+b");
criar_cabecalho_vazio(arq_disciplinas);
criar_cabecalho_vazio(arq_cursos);
criar_cabecalho_vazio(arq_professores);
criar_cabecalho_vazio(arq_professores_disciplinas);
fclose(arq_disciplinas);
fclose(arq_cursos);
fclose(arq_professores);
fclose(arq_professores_disciplinas);
}
int main() {
FILE *arq_cursos = open_arq("cursos.bin");
FILE *arq_disciplinas = open_arq("disciplinas.bin");
FILE *arq_professores = open_arq("professores.bin");
FILE *arq_professores_disciplinas = open_arq("professores_disciplinas.bin");
menu_principal(arq_cursos, arq_disciplinas, arq_professores, arq_professores_disciplinas);
fclose(arq_cursos);
fclose(arq_disciplinas);
fclose(arq_professores);
fclose(arq_professores_disciplinas);
// resetar();
return 0;
}