-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalores.h
55 lines (49 loc) · 1.53 KB
/
valores.h
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
#include <stdio.h>
#include <stdlib.h>
int alterar_valores (char usuario[20], int adm) {
system("CLS");
FILE *V;
V = fopen("valores/quartos.txt", "r");
float val[3][2];
fscanf(V, "%f", &val[0][0]);
fscanf(V, "%f", &val[0][1]);
fscanf(V, "%f", &val[1][0]);
fscanf(V, "%f", &val[1][1]);
fscanf(V, "%f", &val[2][0]);
fscanf(V, "%f", &val[2][1]);
fclose(V);
float qcomum[2], qar[2], qsuite[2];
printf("\n\t\tVALORES DOS QUARTOS\n");
printf("\n\tVALORES ATUAIS\n");
printf("Quarto comum: R$ %.2f por adulto / R$ %.2f por criança\n", val[0][0], val[0][1]);
printf("Quarto com ar condicionado: R$ %.2f por adulto / R$ %.2f por criança\n", val[1][0], val[1][1]);
printf("Suíte: R$ %.2f por adulto / R$ %.2f por criança\n", val[2][0], val[2][1]);
printf("\n\tNOVOS VALORES\n");
printf("QUARTO COMUM (1-3)\n");
printf("Adultos: R$ ");
scanf ("%f", &qcomum[0]);
printf("Crianças: R$ ");
scanf ("%f", &qcomum[1]);
printf("\nQUARTO COM AR CONDICIONADO (4-7)\n");
printf("Adultos: R$ ");
scanf ("%f", &qar[0]);
printf("Crianças: R$ ");
scanf ("%f", &qar[1]);
printf("\nSUÍTE (8-10)\n");
printf("Adultos: R$ ");
scanf ("%f", &qsuite[0]);
printf("Crianças: R$ ");
scanf ("%f", &qsuite[1]);
V = fopen("valores/quartos.txt", "w");
fprintf(V, "%f\n", qcomum[0]);
fprintf(V, "%f\n", qcomum[1]);
fprintf(V, "%f\n", qar[0]);
fprintf(V, "%f\n", qar[1]);
fprintf(V, "%f\n", qsuite[0]);
fprintf(V, "%f\n", qsuite[1]);
fclose(V);
printf("\n\nValores atualizados com sucesso.\n");
system("pause");
menuprincipal(usuario, adm);
return 0;
}