Help with compare an int with an array
in
Programming Questions
•
1 year ago
Hello, sorry for my bad English, I'm Argentine, and also beginning. My problem is: I want to compare the value of an integer variable with the value of the integer variables of an array, I already try this:
-
int sorteado,pos;float sorteado1;boolean comparar,sortear,escribir;int numeros_que_salieron[] = new int[50];boolean ya_salio[] = new boolean[50];
void setup(){size(640,480);background(255);textAlign(CENTER);for(int num=0;num<49;num++){ya_salio[num]=false;}sortear=false;comparar=false;}
void draw(){println(pos);if(sortear){sorteado1=round(random(1,50));sorteado=int(sorteado1);comparar=true;sortear=false;}if(comparar){for(int a=0;a<49;a++){if(sorteado==numeros_que_salieron[a]){sortear=true;}else{escribir=true;}break;}comparar=false;}if(escribir){pos+=1;ya_salio[pos]=true;numeros_que_salieron[pos]=sorteado;escribir=false;}for(int b=0;b<49;b++){if(ya_salio[pos]=true){fill(0);text(pos+" - "+sorteado,22,pos*19);}}}
void mousePressed(){sortear=true;}
But
still giving me
duplicate values
and there is an error whit pos var
:s
1