Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #9  
Antiguo 07-03-2012
Jusar Jusar is offline
Miembro
NULL
 
Registrado: feb 2012
Posts: 17
Poder: 0
Jusar Va por buen camino
Hasta el momento lo que tengo es esto codigo pero no logro eso siempre me puede generar o tres 1 o tres 0 o cuatros 1 o 0...

Código Delphi [-]
void __fastcall TForm1::Button1Click(TObject *Sender)
{
     int mat[2][2];
     for (int i=0;i<2;i++)
         for (int j=0;j<2;j++)
             mat[i][j]= 0;

     int w=0;
     for (int i=0;i<2;i++)
     {
         for (int j=0;j<2;j++)
         {
             int x = random(2);
             for (int a=0;a<2;a++)
             {
                 for (int b=0;b<2;b++)
                 {
                     if ( mat[a][b] == x)
                        w++;
                 }
             }
             if (w<2)
             {
                mat[i][j]=x;
                w=0;
             }
         }
     }

     Label1->Caption=mat[0][0];
     Label2->Caption=mat[0][1];
     Label3->Caption=mat[1][0];
     Label4->Caption=mat[1][1];

}
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
clase estatica D7 FelixInasa OOP 13 17-02-2011 10:48:11
fuzzy implementado en delphi ljrg Varios 4 14-10-2010 15:10:57
variable estatica no muere con el form !!!!!!!!!!! david_uh Varios 5 28-07-2007 00:51:14
.NET es Java pero bien diseñado y mejor implementado roman Noticias 14 22-02-2007 20:43:08
Algoritmo Huffman Implementado En Delphi vespita Internet 8 01-06-2006 18:10:54


La franja horaria es GMT +2. Ahora son las 05:30:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi