Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <clocale>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "");
- const int CLIENTES = 50;
- const int TIPOSENT = 10;
- int nroEntrenamiento, minutosEnt, cliente, tipoEnt;
- int tiempoTotalCliente[CLIENTES] = {};
- bool tiposEntPorCliente[CLIENTES][TIPOSENT] = {};
- int minEntPorCliente[CLIENTES][TIPOSENT] = {};
- int maxTiempoEntrenamiento = 0, maxClienteEnt = 0;
- cout << "Ingrese número de entrenamiento (0 para terminar): " << endl;
- cin >> nroEntrenamiento;
- while (nroEntrenamiento != 0) {
- cout << "Ingrese cliente (101-150): " << endl;
- cin >> cliente;
- cout << "Ingrese tiempo total de entrenamiento en minutos: " << endl;
- cin >> minutosEnt;
- cout << "Ingrese el tipo de entrenamiento que realizó (1-10): " << endl;
- cin >> tipoEnt;
- tiempoTotalCliente[cliente - 101] += minutosEnt;
- tiposEntPorCliente[cliente - 101][tipoEnt - 1] = true;
- minEntPorCliente[cliente - 101][tipoEnt - 1] += minutosEnt;
- if (tiempoTotalCliente[cliente - 101] > maxTiempoEntrenamiento) {
- maxTiempoEntrenamiento = tiempoTotalCliente[cliente - 101];
- maxClienteEnt = cliente;
- }
- cout << "--------------------------------------" << endl;
- cout << "Ingrese número de entrenamiento (0 para terminar): " << endl;
- cin >> nroEntrenamiento;
- }
- // 1 - Tiempo total de entrenamiento por cliente
- cout << "Tiempo total de entrenamiento por cliente:" << endl;
- for (int i = 0; i < CLIENTES; i++) {
- if (tiempoTotalCliente[i] > 0) {
- int horas = tiempoTotalCliente[i] / 60;
- int minutos = tiempoTotalCliente[i] % 60;
- cout << "Cliente " << (i + 101) << ": " << horas << " horas y " << minutos << " minutos" << endl;
- }
- }
- // 2 - Tipos de entrenamiento realizados por cada cliente
- cout << "Tipos de entrenamiento realizados por cada cliente:" << endl;
- for (int i = 0; i < CLIENTES; i++) {
- bool tuvoTiposEnt = false;
- for (int j = 0; j < TIPOSENT; j++) {
- if (tiposEntPorCliente[i][j]) {
- if (!tuvoTiposEnt) {
- cout << "Cliente " << (i + 101) << ": ";
- tuvoTiposEnt = true;
- }
- cout << (j + 1) << " ";
- }
- }
- if (tuvoTiposEnt) {
- cout << endl;
- }
- }
- // 3 - Minutos por tipo de entrenamiento por cliente
- cout << "Minutos por tipo de entrenamiento por cliente:" << endl;
- for (int i = 0; i < CLIENTES; i++) {
- for (int j = 0; j < TIPOSENT; j++) {
- if (minEntPorCliente[i][j] > 0) {
- cout << "Cliente " << (i + 101) << ", Tipo de entrenamiento " << (j + 1) << ": " << minEntPorCliente[i][j] << " minutos" << endl;
- }
- }
- }
- // 4 - Cliente que más tiempo ha entrenado
- cout << "El cliente que más tiempo entrenó es el cliente " << maxClienteEnt << " con " << maxTiempoEntrenamiento << " minutos." << endl;
- // 5 - Tipos de entrenamiento no realizados por ningún cliente
- cout << "Tipos de entrenamiento no realizados por ningún cliente:" << endl;
- for (int j = 0; j < TIPOSENT; j++) {
- bool realizoTipoEnt = false;
- for (int i = 0; i < CLIENTES; i++) {
- if (tiposEntPorCliente[i][j] == true) {
- realizoTipoEnt = true;
- }
- }
- if (!realizoTipoEnt) {
- cout << "Tipo de entrenamiento " << (j + 1) << " no fue realizado por ningún cliente." << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement