.dsy:it. Pages (2): « 1 [2]
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Fondamenti di architettura e programmazione (http://www.dsy.it/forum/forumdisplay.php?forumid=234)
-- [Laboratorio] Es. x il 5-12 ORDINA E RICERCA FIGURE (http://www.dsy.it/forum/showthread.php?threadid=7164)


Posted by supernova on 04-12-2003 15:19:

Raga io faccio così ma non mi va!!!!!! Sto cazzo di binarySearch()! Che c'è che non va!!!!! HELP ME!!! HELP HELP HELP!!!!



Shape x = null;
switch (c) {
case 'r' :
video.println("La forma e' un rettangolo");
n1 = tastiera.readDouble("Inserisci l'altezza : ");
n2 = tastiera.readDouble("Inserisci la base : ");
video.println(" ");
x = new Rectangle(n1,n2);
break;
......................................................................
for (int f=0;f<MAX;f++)
int risultato = java.util.Arrays.binarySearch(forme[f],x);
if (risultato>=0){
forme[risultato].draw();
video.println("La mia area e' : " + forme[risultato].calculateArea());
}
else{
video.println("Forma non trovata");
}

__________________
" So I Start The Revolution From My Bed ". Noel Gallagher


Posted by Mifune on 04-12-2003 15:23:

Originally posted by supernova
Raga io faccio così ma non mi va!!!!!! Sto cazzo di binarySearch()! Che c'è che non va!!!!! HELP ME!!! HELP HELP HELP!!!!



Shape x = null;
switch (c) {
case 'r' :
video.println("La forma e' un rettangolo");
n1 = tastiera.readDouble("Inserisci l'altezza : ");
n2 = tastiera.readDouble("Inserisci la base : ");
video.println(" ");
x = new Rectangle(n1,n2);
break;
......................................................................
for (int f=0;f<MAX;f++)
int risultato = java.util.Arrays.binarySearch(forme[f],x);
if (risultato>=0){
forme[risultato].draw();
video.println("La mia area e' : " + forme[risultato].calculateArea());
}
else{
video.println("Forma non trovata");
}




io dico solo nn riesco a fare un cippo di questo eserciccio nn mi viene!!!!

__________________
Imac G5 2.1 Ghz 20" 1.5 Ram - Ibook 1.2 Ghz 12" 768 Ram - Ipod mini 4Gb - Base airport extreme - jbl creature
nippi.it - Blog


Posted by supernova on 04-12-2003 15:27:

X quanto riguarda l'ordinamento l'ho fatto con sort e fin li mi va, ma sto cazzo di binarySearch() mi frega!!!!!!!! QUALCUNO CI AIUTI!!!!!!!!!!

__________________
" So I Start The Revolution From My Bed ". Noel Gallagher


Posted by c3ru on 04-12-2003 17:43:

Smile

il binary search riceve un array come argomento, tu mettendogli l'array[f] gli dai come argomento un oggetto

ecco perchè non va

ciao C3ru


Posted by supernova on 04-12-2003 19:24:

e cosa gli devo mettere allora ???? Fate degli esempi di come l'avete risolto. please please!!!!

__________________
" So I Start The Revolution From My Bed ". Noel Gallagher


Posted by c3ru on 04-12-2003 19:47:

Thumbs up

int x = java.util.Arrays.binarySearch (Sarr, r);

dove Sarr è l'array di figure mentre r è la nuova figura introdotta


All times are GMT. The time now is 08:18. Pages (2): « 1 [2]
Show all 21 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.