-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdinheiro.cpp
More file actions
106 lines (76 loc) · 2.92 KB
/
dinheiro.cpp
File metadata and controls
106 lines (76 loc) · 2.92 KB
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
#include <iostream>
#include <string>
#include <stdlib.h>
#include <time.h>
#include <fstream>
#include <cmath>
#include <iomanip>
#include "maquina.h"
#include "funcionario.h"
#include "dinheiro.h"
caixa VetDinheiro[6];
float TotalCaixa = 0;
void iniciaCaixa() {
caixa* novaMoeda = new caixa;
novaMoeda->ID = 5;
novaMoeda->nome = "5 cêntimos";
novaMoeda->valor = 0.05;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[5] = *novaMoeda;
novaMoeda->ID = 10;
novaMoeda->nome = "10 cêntimos";
novaMoeda->valor = 0.10;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[4] = *novaMoeda;
novaMoeda->ID = 20;
novaMoeda->nome = "20 cêntimos";
novaMoeda->valor = 0.20;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[3] = *novaMoeda;
novaMoeda->ID = 50;
novaMoeda->nome = "5 cêntimos";
novaMoeda->valor = 0.50;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[2] = *novaMoeda;
novaMoeda->ID = 1;
novaMoeda->nome = "1 euro";
novaMoeda->valor = 1.00;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[1] = *novaMoeda;
novaMoeda->ID = 2;
novaMoeda->nome = "2 euros";
novaMoeda->valor = 2.00;
novaMoeda->quantidade = aleatorio(10, 20);
VetDinheiro[0] = *novaMoeda;
}
void avisoMoedas() {
cout << endl;
for (int i = 0; i <= 5; i++) {
if (VetDinheiro[i].quantidade == 3) {
cout << "*** ATENÇAO! Existem apenas 3 moedas de " << VetDinheiro[i].valor << simboloEuro() << " ***" << endl;
}
if (VetDinheiro[i].quantidade == 2) {
cout << "*** ATENÇAO! Existem apenas 2 moedas de " << VetDinheiro[i].valor << simboloEuro() << " ***" << endl;
}
if (VetDinheiro[i].quantidade == 1) {
cout << "*** ATENÇAO! Existe apenas 1 moeda de " << VetDinheiro[i].valor << simboloEuro() << " ***" << endl;
}
if (VetDinheiro[i].quantidade == 0) {
cout << "*** ATENÇAO! Não existem moedas de " << VetDinheiro[i].valor << simboloEuro() << " ***" << endl;
}
}
cout << endl;
}
void mostraCaixa() {
TotalCaixa = (VetDinheiro[0].quantidade * VetDinheiro[0].valor) + (VetDinheiro[1].quantidade * VetDinheiro[1].valor) + (VetDinheiro[2].quantidade * VetDinheiro[2].valor) +
(VetDinheiro[3].quantidade * VetDinheiro[3].valor) + (VetDinheiro[4].quantidade * VetDinheiro[4].valor) + (VetDinheiro[5].quantidade * VetDinheiro[5].valor);
cout << "Total em caixa: " << setprecision(2) << fixed << TotalCaixa << simboloEuro() << endl;
cout << "Moedas de 2 euros: " << VetDinheiro[0].quantidade << endl;
cout << "Moedas de 1 euro: " << VetDinheiro[1].quantidade << endl;
cout << "Moedas de 50 cêntimos: " << VetDinheiro[2].quantidade << endl;
cout << "Moedas de 20 cêntimos: " << VetDinheiro[3].quantidade << endl;
cout << "Moedas de 10 cêntimos: " << VetDinheiro[4].quantidade << endl;
cout << "Moedas de 5 cêntimos: " << VetDinheiro[5].quantidade << endl;
cout << endl;
avisoMoedas();
}