Results 1 to 3 of 3
Thread: how to resolve last funtion
- 10-27-2011, 08:16 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 18
- Rep Power
- 0
how to resolve last funtion
well I expose th prblem I have a function that resolve the square root of a int on recursive mode , other funtion that says if a matrix is ssymmetric or not in a recursive mode, an the last function must say if the matrix of the square root of the elements is symmetric or not in a recursive mode too, i know i must use the 2 funtion before but always i have the same exception stack overflow i put here the code i have
Java Code:package main; /** * * @author adriandelasmatas */ public class Main { public static final int i = 4; public static final int j = 4; public static int x = 0; public static int y = 0; public static boolean sym = true; public static int m[][] = new int[i][j]; public static int n ; public static int r; /** * @param args the command line arguments */ public static void main(String[] args) { m[0][0]=1; m[1][0]= 4; m[2][0]= 3; m[3][0]= 2; m[0][1]=4; m[1][1]=1; m[2][1]=2; m[3][1]= 4; m[0][2]=3; m[1][2]=2; m[2][2]=1; m[3][2]=3; m[0][3]=2; m[1][3]=4; m[2][3]=3; m[3][3]=1; SqrtMatSym(m); System.out.println(SqrtMatSym(m)); } public static int sqrt(int n) { //pre >= 0; if ( (n >= (r*r)) && (n < (r+1)*(r+1)) ){ return(r); }else { r++; sqrt(n); }return (r); } public boolean matrix(int[][] m) { if ( i == j){ if (sym== true){ if (x != m.length - 1) { if (y == m[x].length - 1) { if (m[x][y] != m[y][x]) { sym = false; } x++; y = 0; matrix(m); } else { if (m[x][y] != m[y][x]) { sym = false; } else { y++; matrix(m); } } } } }else{ sym = false;} return sym; } public static boolean SqrtMatSym(int[][] m) { //need to do teh sqrt of all elements and know if is sym if ( i == j){ if (sym== true){ if (x != m.length - 1) { if (y == m[x].length - 1) { if (m[x][y] != m[y][x]) { sym = false; } x++; y = 0; SqrtMatSym(m); } else { if (m[x][y] != m[y][x]) { sym = false; } else { y++; SqrtMatSym(m); } } } } }else{ sym = false;} return sym; } }
- 10-28-2011, 01:30 AM #2
Re: how to resolve last funtion
-
Re: how to resolve last funtion
This thread is now closed. Original poster: please don't multi-post questions.
Similar Threads
-
help me to resolve this error
By akiravelmont in forum Web FrameworksReplies: 3Last Post: 05-17-2011, 02:04 PM -
any one help me to resolve this error
By akiravelmont in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 03-11-2011, 06:06 PM -
how to resolve this error???
By 10e5x in forum New To JavaReplies: 1Last Post: 01-21-2011, 07:40 AM -
funtion of close() method?
By hacikho in forum New To JavaReplies: 7Last Post: 10-11-2010, 01:08 AM -
Yet another Cannot Resolve Symbol
By Gabinka in forum New To JavaReplies: 5Last Post: 03-27-2009, 10:28 PM


LinkBack URL
About LinkBacks

Bookmarks