-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
61 lines (54 loc) · 1.6 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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "reservas.h"
int main() {
Sala *salas = NULL;
int numSalas = 0;
Reserva *reservas = NULL;
int numReservas = 0;
int opcao;
inicializarSalas(&salas, &numSalas);
lerReservasDoArquivo(&reservas, &numReservas);
do {
printf("\nMenu Principal\n");
printf("1 - Criar Sala\n");
printf("2 - Reservar Sala\n");
printf("3 - Listar Salas\n");
printf("4 - Listar Todas Reservas\n");
printf("5 - Listar Reservas de uma Sala\n");
printf("6 - Cancelar Reserva\n");
printf("0 - Encerrar Programa\n");
printf("Escolha uma opção: ");
scanf("%d", &opcao);
switch (opcao) {
case 1:
criarSala(&salas, &numSalas);
break;
case 2:
reservarSala(salas, numSalas, &reservas, &numReservas);
break;
case 3:
listarTodasSalas(salas, numSalas, reservas, numReservas);
break;
case 4:
listarTodasReservas(reservas, numReservas, salas, numSalas);
break;
case 5:
listarReservasDeUmaSala(reservas, numReservas, salas, numSalas);
break;
case 6:
cancelarReserva(&reservas, &numReservas, salas, numSalas);
break;
case 0:
encerrarPrograma(salas, reservas, numReservas);
break;
default:
printf("Opção inválida!\n");
}
} while (opcao != 0);
free(salas);
free(reservas);
return 0;
}