#include <iostream>
#include <vector>
#include <ctime>
using namespace std;
struct Cliente {
int id;
string nombre;
int tiempoCiber; // en minutos
int tiempoLlamadas; // en segundos
};
// Función para mostrar los detalles de un cliente
void mostrarCliente(const Cliente& cliente) {
cout << "ID: " << cliente.id << endl;
cout << "Nombre: " << cliente.nombre << endl;
cout << "Tiempo en el cibercafé: " << cliente.tiempoCiber << " minutos" << endl;
cout << "Tiempo de llamadas: " << cliente.tiempoLlamadas << " segundos" << endl;
}
// Función para agregar un nuevo cliente
void agregarCliente(vector<Cliente>& clientes) {
Cliente nuevoCliente;
nuevoCliente.id = clientes.size() + 1; // ID único
cout << "Ingrese el nombre del cliente: ";
getline(cin >> ws, nuevoCliente.nombre);
cout << "Ingrese el tiempo en el cibercafé (minutos): ";
cin >> nuevoCliente.tiempoCiber;
cout << "Ingrese el tiempo de llamadas (segundos): ";
cin >> nuevoCliente.tiempoLlamadas;
clientes.push_back(nuevoCliente);
cout << "Cliente agregado exitosamente." << endl;
}
// Función para actualizar los tiempos de los clientes
void actualizarTiempos(vector<Cliente>& clientes) {
for (Cliente& cliente : clientes) {
if (cliente.tiempoCiber > 0) {
cliente.tiempoCiber--;
}
if (cliente.tiempoLlamadas > 0) {
cliente.tiempoLlamadas--;
}
}
cout << "Tiempos actualizados exitosamente." << endl;
}
// Función principal
int main() {
vector<Cliente> clientes;
int opcion;
do {
cout << "\nMENÚ DE OPCIONES" << endl;
cout << "1. Agregar cliente" << endl;
cout << "2. Mostrar clientes" << endl;
cout << "3. Actualizar tiempos" << endl;
cout << "4. Salir" << endl;
cout << "Ingrese su opción: ";
cin >> opcion;
switch (opcion) {
case 1:
agregarCliente(clientes);
break;
case 2:
cout << "\nLISTA DE CLIENTES" << endl;
for (const Cliente& cliente : clientes) {
mostrarCliente(cliente);
cout << "------------------------" << endl;
}
break;
case 3:
actualizarTiempos(clientes);
break;
case 4:
cout << "Saliendo del programa. Hasta luego." << endl;
break;
default:
cout << "Opción no válida. Intente nuevamente." << endl;
}
} while (opcion != 4);
return 0;
}