usando netbeans cuarquiera se cree que lo sabe todo
![:xD :xD](https://forum.elhacker.net/Smileys/navidad/xd.gif)
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: monsefoster en 21 Febrero 2010, 07:41 AM
LEYER! Eres lo maximo!
Casate conmigo! Necesito un novio genio!
Creo que le quitare el "Cerrar" pq me da cantidad de errores cuando coloco elSystem.exit(0);
Cita de: monsefoster en 21 Febrero 2010, 07:06 AMcasidiablo
Disculpen la molestia, y no se anden trasnochando
public void keyReleased (KeyEvent x){
double aux,f;
if (x.getSource ()==c1){
if(x.getKeyCode()==KeyEvent.VK_ENTER){
aux = Double.parseDouble (c1.getText());
f=(aux*(9/5)+32);
r.setText (""+f);
}
}
}
Sumar el Marco de una matriz recursivamente, la matriz la pueden tomar como sea, fija o ingresando los datos ... como quieran :xD.
import java.util.Random;
public class Test {
public static final int N_COLUMNS = 4;
public static final int N_ROWS = 4;
public static void proc(int[]matriz[],int n,int sum){
switch (n) {
case 0:{for(int indexRow=0;indexRow<matriz.length;indexRow++){
sum+=matriz[0][indexRow];
}print("- West sum -\t"+sum);proc(matriz, 1,0);
break;
}
case 1:{for(int indexRows=0;indexRows<matriz.length;indexRows++){
sum+=matriz[matriz.length-1][indexRows];
}print("- East sum -\t"+sum);proc(matriz, 2,0);
break;
}
case 2:{for(int indexColumn=0;indexColumn<matriz.length;indexColumn++){
sum+=matriz[indexColumn][0];
}print("- South sum -\t"+sum);proc(matriz, 3,0);
break;
}
case 3:{for(int indexColumn=0;indexColumn<matriz.length;indexColumn++){
sum+=matriz[indexColumn][matriz.length-1];
}print(" -North sum -\t"+sum);
break;
}}
}
public static void print(String text){
System.out.println(text);
}
public static void main(String args[]) {
int[]matriz[]=new int[N_COLUMNS][N_ROWS];
for(int indexColum=0,indexRows=0;indexColum<matriz.length;indexColum++){
do{
matriz[indexColum][indexRows] = new Random().nextInt(10);
indexRows++;
}while(indexRows<matriz.length);
indexRows=0;
}
System.out.println("------- Matriz -------");
for(int indexRows=0;indexRows<matriz.length;indexRows++){
System.out.println("|"+matriz[0][indexRows]+"|" +
" |"+matriz[1][indexRows]+"|" +
" |"+matriz[2][indexRows]+"|" +
" |"+matriz[3][indexRows]+"|");
}
System.out.println("-----------------------");
proc(matriz,0,0);
}
}