#include <iostream>
#include <string>
using namespace std;
// Definici�n de estructuras
struct Proveedor {
string nombre;
string telefono;
string direccion;
};
struct Empleado {
string nombre;
string telefono;
string direccion;
};
struct Cliente {
string nombre;
string telefono;
string direccion;
};
// Funciones para verificar si ya existe
bool existeProveedor(Proveedor proveedores[], int cantidad, string nombre) {
for (int i = 0; i < cantidad; ++i) {
if (proveedores[i].nombre == nombre) {
return true;
}
}
return false;
}
// Funciones para verificar si ya existe
bool existeEmpleado(Empleado empleados[], int cantidad, string nombre) {
for (int i = 0; i < cantidad; ++i) {
if (empleados[i].nombre == nombre) {
return true;
}
}
return false;
}
// Funciones para verificar si ya existe
bool existeCliente(Cliente clientes[], int cantidad, string nombre) {
for (int i = 0; i < cantidad; ++i) {
if (clientes[i].nombre == nombre) {
return true;
}
}
return false;
}
// Funciones para registrar
void registrarProveedor(Proveedor proveedores[], int &cantidad) {
Proveedor nuevo;
cout << "Ingrese nombre del proveedor: ";
cin >> [Link];
cout << "Ingrese tel�fono del proveedor: ";
cin >> [Link];
cout << "Ingrese direcci�n del proveedor: ";
cin >> [Link];
if (existeProveedor(proveedores, cantidad, [Link])) {
cout << "El proveedor ya existe.\n";
} else {
proveedores[cantidad++] = nuevo;
cout << "Proveedor registrado exitosamente.\n";
}
}
void registrarEmpleado(Empleado empleados[], int &cantidad) {
Empleado nuevo;
cout << "Ingrese nombre del empleado: ";
cin >> [Link];
cout << "Ingrese tel�fono del empleado: ";
cin >> [Link];
cout << "Ingrese direcci�n del empleado: ";
cin >> [Link];
if (existeEmpleado(empleados, cantidad, [Link])) {
cout << "El empleado ya existe.\n";
} else {
empleados[cantidad++] = nuevo;
cout << "Empleado registrado exitosamente.\n";
}
}
void registrarClientes(Cliente clientes[], int &cantidad) {
Cliente nuevo;
cout << "Ingrese nombre del cliente: ";
cin >> [Link];
cout << "Ingrese tel�fono del cliente: ";
cin >> [Link];
cout << "Ingrese direcci�n del cliente: ";
cin >> [Link];
if (existeCliente(clientes, cantidad, [Link])) {
cout << "El cliente ya existe.\n";
} else {
clientes[cantidad++] = nuevo;
cout << "cliente registrado exitosamente.\n";
}
}
// Funci�n para mostrar los proveedores registrados
void mostrarProveedores(Proveedor proveedores[], int cantidad) {
if (cantidad == 0) {
cout << "No hay proveedores registrados.\n";
return;
}
cout << "Lista de proveedores registrados:\n";
for (int i = 0; i < cantidad; ++i) {
cout << "Proveedor " << i + 1 << ":\n";
cout << "Nombre: " << proveedores[i].nombre << "\n";
cout << "Tel�fono: " << proveedores[i].telefono << "\n";
cout << "Direcci�n: " << proveedores[i].direccion << "\n";
cout << "----------------------\n";
}
}
// Funci�n para mostrar los proveedores registrados
void mostrarEmpleados(Empleado empleados[], int cantidad) {
if (cantidad == 0) {
cout << "No hay empleados registrados.\n";
return;
}
cout << "Lista de empleados registrados:\n";
for (int i = 0; i < cantidad; ++i) {
cout << "Empleado " << i + 1 << ":\n";
cout << "Nombre: " << empleados[i].nombre << "\n";
cout << "Tel�fono: " << empleados[i].telefono << "\n";
cout << "Direcci�n: " << empleados[i].direccion << "\n";
cout << "----------------------\n";
}
}
// Funci�n para mostrar los proveedores registrados
void mostrarClientes(Cliente clientes[], int cantidad) {
if (cantidad == 0) {
cout << "No hay clientes registrados.\n";
return;
}
cout << "Lista de clientes registrados:\n";
for (int i = 0; i < cantidad; ++i) {
cout << "Cliente " << i + 1 << ":\n";
cout << "Nombre: " << clientes[i].nombre << "\n";
cout << "Tel�fono: " << clientes[i].telefono << "\n";
cout << "Direcci�n: " << clientes[i].direccion << "\n";
cout << "----------------------\n";
}
}
int main() {
const int MAX = 100;
Proveedor proveedores[MAX];
Empleado empleados[MAX];
Cliente clientes[MAX];
int cantidadProveedores = 0;
int cantidadEmpleados = 0;
int cantidadClientes = 0;
int opcion;
do {
cout << "\nSistema de Ventas\n";
cout << "1. Registrar Proveedor\n";
cout << "2. Registrar Empleado\n";
cout << "3. Mostrar Empleado\n";
cout << "4. Mostrar Proveedores\n";
cout << "5. Registrar Clientes\n";
cout << "6. Mostrar Clientes\n";
cout << "7. Salir\n";
cout << "Seleccione una opci�n: ";
cin >> opcion;
switch (opcion) {
case 1:
registrarProveedor(proveedores, cantidadProveedores);
break;
case 2:
registrarEmpleado(empleados, cantidadEmpleados);
break;
case 3:
mostrarEmpleados(empleados, cantidadEmpleados);
break;
case 4:
mostrarProveedores(proveedores, cantidadProveedores);
break;
case 5:
registrarClientes(clientes, cantidadClientes);
break;
case 6:
mostrarClientes(clientes, cantidadClientes);
break;
case 7:
cout << "Saliendo...\n";
break;
default:
cout << "Opci�n no v�lida. Intente de nuevo.\n";
}
} while (opcion != 5);
return 0;
}