Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2011, 14:46
jesus_informatico
 
Fecha de Ingreso: diciembre-2011
Mensajes: 1
Antigüedad: 12 años, 5 meses
Puntos: 0
Información ¿Como detectar numeros repetidos y datos fuera de rango en una matriz?

Hola buenas tardes. Soy nuevo en el foro, asi k si cometo alguna infraccion, disculpenme.
Bueno, mi duda era la siguiente.
Yo ya tengo definido una matriz, y es así.



int matriz_manual[][] = new int[7][numero_columnas];
for (int j=0; j<numero_columnas; j++){
System.out.println ("Columna "+(j+1)+":");
for (int i=0; i<5; i++){
System.out.println ("Numero "+(i+1)+":");
matriz_manual[i][j] = leer.nextInt();
}
for (int i=5; i<7; i++){
System.out.println ("Estrella "+(i-4)+":");
matriz_manual[i][j] = leer.nextInt();
}
}
for (int j=0; j<numero_columnas; j++) {
System.out.print ("Columna "+(j+1)+"ª: ");
for (int i=0; i<7; i++){
System.out.print (matriz_manual[i][j]+" ");
}
System.out.println();
}

Ahora, yo lo he probado con el eclipse y esto me funciona. Consiste en una matriz, en la que yo decido las columnas que quiero yo jugar. Pero a la hora de que yo meta un numero repetido, quiero que aparezca "Por favor vuelva a introducir de nuevo todos los datos del juego" y si el numero esta fuera de un rango, que me diga "Por favor vuelva a introducir el dato en el rango correspondiente".
Estos dos ultimos es lo que no entiendo. Si me pudieran ayudar, muchas gracias.