cuando ejecuto me ordena de forma aleratoria el problema está en la funcion para generar los numeros aleatorios, al parecer me genera numeros repetidos por q monta a los botones uno encima de otros
bueno esta es mi modo de generar mi arreglo de numeros aleatorios y ordenar los botones de acuerdo a la posicion:
Código visual c++:
Ver original
private: System::Void Arreglo(){ randomize(); vector[0]=rand()%16+1; for(c=1;c<=15;c++){ ale = rand()%16+1; for(int i=0;i<=c;i++) { if(vector[i]==ale) { ale = rand()%16+1; i=0; } } vector[c]=ale; } } private: System::Void Ubica(){ this->Arreglo(); if(vector[0]==1){ this->button1->Location=System::Drawing::Point(12,43); this->pb1->Location = System::Drawing::Point(12, 43); }else if(vector[0]==2) { this->button2->Location=System::Drawing::Point(12,43); this->pb2->Location = System::Drawing::Point(12, 43); }else if(vector[0]==3) { this->button3->Location=System::Drawing::Point(12,43); this->pb3->Location = System::Drawing::Point(12, 43); }else if(vector[0]==4) { this->button4->Location=System::Drawing::Point(12,43); this->pb4->Location = System::Drawing::Point(12, 43); }
espero me puedan ayudarcon este probleita, anticipadamente mil gracias...
un abrazo a to2 salu2...