



Código
#include <cstdlib> #include "windows.h" #include <iostream> using namespace std; int menu (){ HANDLE hConsoleHandle = GetStdHandle (STD_OUTPUT_HANDLE); int exit=0; int opcion; printf("\n"); SetConsoleTextAttribute (hConsoleHandle, 2 | FOREGROUND_INTENSITY); printf("\n *** MENU PRINCIPAL ***\n"); printf(" --------------------"); SetConsoleTextAttribute (hConsoleHandle, 7 | FOREGROUND_INTENSITY); printf("\n \t1. Insertar Elementos al Arreglo"); printf("\n \t2. Buscar Elementos Del arreglo"); printf("\n \t3. Eliminar Elementos Del Arreglo"); printf("\n \t4. Ordenar El Arreglo "); printf("\n \t4. Ver El Arreglo "); printf("\n \t5. Salir\n"); while (exit == 0) { SetConsoleTextAttribute (hConsoleHandle, 2 | FOREGROUND_INTENSITY); cout<<"\nOpcion: "; SetConsoleTextAttribute (hConsoleHandle, 7 | FOREGROUND_INTENSITY); scanf("%d", &opcion); switch(opcion) { case 1: system("CLS"); cout<<"\n\n Insertar"; menu(); break; case 2: system("CLS"); cout<<"\n\n Buscar"; menu(); break; case 3: system("CLS"); cout<<"\n\n Eliminar"; menu(); break; case 4: system("CLS"); cout<<"\n\n Ordenar"; menu(); break; case 5: // VerArreglo(); break; case 6: exit = 1; return EXIT_SUCCESS; break; default: printf("\n ** Esta opcion no es valida **\n"); } } system("CLS"); } main () { int n; HANDLE hConsoleHandle = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute (hConsoleHandle, 7 | FOREGROUND_INTENSITY); cout<<"\n Ingrese la longitud del arreglo: "; SetConsoleTextAttribute (hConsoleHandle, 2 | FOREGROUND_INTENSITY); cin>>n; if ((n>=1)&&(n<=100)){}else{main();} int vector[n]; for (int i=1; i<=n;i++){ cin>>vector[i]; } system("CLS"); menu(); return 0; }