Es redundante colocar el break ahí, la aplicación simplemente va a seguir con su ejecución normal, esto se debe a que cuando se cumple uno de los casos dentro del switch la aplicación continua su ejecución secuencial y como podemos observar que el caso "default' es el último no hace falta colocar un break para romper con la estructura de control.
Tienes razón no influye en nada.. perdon por lo anterior..
Así quedaría el codigo arreglado , lo unico que hice fue cambiar la variable x (int) , por una variable tipo char , para asi puedo comprobar los datos ingresados con la tabla ascii y verificar si el dato ingresado es un numero o no.
Codigo :
#include <iostream>
#include <stdio.h>
#include<windows.h>
#define MAX 10
using namespace std;
void burbuja();
void seleccion();
void salir();
main(void)
{
system("color 0A"); //COLOR PARA LA CONSOLA
int seguir=1;
char x; cout<<endl<<"\t##################################################################";
cout<<endl<<"\t# METODOS DE ORDENAMIENTO #";
cout<<endl<<"\t# METODO DE LA BURBUJA Y SELECCION DIRECTA #"; //PORTADA DEL PROMAGRA!
cout<<endl<<"\t# IS5D-C #";
cout<<endl<<"\t##################################################################"<<endl;
cout<<endl;
cout<<endl;
do // COMIENZO DEL CICLO REPETITIVO DO - WHILE
{
cout<<endl<<"\t\t******************* M E N U ******************";
cout<<endl<<"\t\t* *";
cout<<endl<<"\t\t* 1.- Ordenamiento por Metodo Burbuja *";
cout<<endl<<"\t\t* *";
cout<<endl<<"\t\t* 2.- Ordenamiento por Metodo Seleccion *"; //MENU DEL PROGRAMA!
cout<<endl<<"\t\t* *";
cout<<endl<<"\t\t* 3.- Salir *";
cout<<endl<<"\t\t**********************************************";
cout<<endl;
cout<<endl;
cout<<endl<<">> ELIGE UNA OPCION: "; //PEDIR OPCION DEL MENU!
cout<<endl<<" -------------------> ";
cin>>x;
if(x<48 || x>57) /* si es un caracter y no un numero vuelve al do*/
{
cout<<"Un numero porfavor.."<<endl;
continue;
} cout<<endl<<endl;
switch (x){
case
'1':burbuja(); /*recuerda va entre ' ' , estamos hablando de char*/
break;
case '2':seleccion();
break;
case '3':
seguir = 0;
break;
default: cout<<"ERROR, OPCION INVALIDA.."<<endl; //OPCION INVALIDA.
}
if (seguir!=0)
{
cout <<endl<< "DESEA CONTINUAR?? SI - PRESIONAR 1 , NO - PRESIONAR 0 ";
cin >> seguir;
}
}while (seguir==1); //FIN DEL BUCLE DO - WHILE
cout<<endl;
system("PAUSE");
}
void burbuja()
{
int I,N,Aux,J;
int V[10];
cout<<"Cuantos Numeros va a Ingresar al Vector?, Maximo 10: ";
cin>>N;
cout<<endl;
for(I=0; I<N; I++)
{
cout<<"Ingrese Dato "<<I+1<<": ";
cin>>V
;
}
for (I=0; I<N-1; I++)
for (J=0; J<(N-1)-I; J++)
if (V[J]>V[J+1])
{
Aux=V[J];
V[J]=V[J+1];
V[J+1]=Aux ;
}
cout<<endl<<"[ NUMEROS ORDENADOS MEDIANTE BURBUJA ] "<<endl;
for(I=0; I<N; I++)
cout<<endl<<"\t\t"<<V;
cout<<endl<<endl;
}
void seleccion()
{
int J,I,N,K;
int V[10];
int Aux;
cout<<"Cuantos Numeros va a Ingresar al Vector?, Maximo 10: ";
cin>>N;
cout<<endl;
for(I=0; I<N; I++)
{
cout<<"Ingrese Dato "<<I+1<<": ";
cin>>V;
}
for(I=0; I<N-1; I++)
{
K=I;
for (J=I+1; J<N; J++)
if (V[J]<V[K])
K=J;
Aux=V;
V=V[K];
V[K]=Aux;
}
cout<<endl<<"[ NUEMROS ORDENADOS MEDIANTE SELECCION ]"<<endl;
for(I=N-1; I>=0; I--)
cout<<endl<<"\t\t"<<V;
cout<<endl<<endl;
system("exit");
}