-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeaje.cpp
45 lines (38 loc) · 1.06 KB
/
peaje.cpp
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
#include <iostream>
#include <string>
int main() {
std::string categoria, tarifa;
int total = 0;
// Entrada de la categoría
std::cout << "Ingrese categoria: ";
std::cin >> categoria;
// Entrada de la tarifa
std::cout << "Ingrese tarifa: ";
std::cin >> tarifa;
// Cálculo del total
if (categoria == "auto" || categoria == "camioneta") {
if (tarifa == "normal") {
total = 2000;
} else {
total = 3000;
}
} else if (categoria == "moto") {
if (tarifa == "normal") {
total = 600;
} else {
total = 900;
}
} else if (categoria == "camion" || categoria == "bus") {
if (tarifa == "normal") {
total = 3500;
} else {
total = 5200;
}
}
// Mostrar el ticket
std::cout << "\n ------ TICKET ------\n";
std::cout << " Categoria: " << categoria << "\n";
std::cout << " Tarifa: " << tarifa << "\n";
std::cout << " Total: $" << total << "\n";
return 0;
}