Réponse acceptée !
J'ai trouvé la réponse! il suffit d'appuyer 4 fois sur mon Button1 voici donc mon unité:
//---------------------------------------------------------------------------
#include <stdlib.h>
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include <dos.h>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int choix[4]; //tableau random
int test[4]; //tableau à tester, choisi par l'utilisateur dans les ComboBox
int nb_juste, nb_mal_places;
int compte_tours_clique;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
compte_tours_clique=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
struct time t;
if (compte_tours_clique<=4)
{
gettime(&t);
choix[compte_tours_clique] = t.ti_hund%10;
compte_tours_clique = compte_tours_clique+1;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
test[1] = 0;
test[2] = 0;
test[3] = 0;
test[4] = 0;
int test[4]; //tableau à tester, choisi par l'utilisateur dans les ComboBox
int compte_tours, compte_tours2;
if (RadioGroup1->ItemIndex >= 0)
{
test[0] = StrToInt(ComboBox1->Text);
}
if (RadioGroup1->ItemIndex >= 1)
{
test[1] = StrToInt(ComboBox2->Text);
}
if (RadioGroup1->ItemIndex >= 2)
{
test[2] = StrToInt(ComboBox3->Text);
}
if (RadioGroup1->ItemIndex >= 3)
{
test[3] = StrToInt(ComboBox4->Text);
}
for (compte_tours = 0;compte_tours <= RadioGroup1->ItemIndex; compte_tours++)
{
if (choix[compte_tours] == test[compte_tours])
{
nb_juste = nb_juste+1;
}
for (compte_tours2 = 0;compte_tours2 <= RadioGroup1->ItemIndex; compte_tours2++)
{
if ((test[compte_tours] == choix[compte_tours2]) && (compte_tours != compte_tours))
{
nb_mal_places = nb_mal_places + 1;
}
}
}
Label5->Caption = nb_juste;
Label6->Caption = nb_mal_places;
Label8->Caption = (RadioGroup1->ItemIndex + 1) - (nb_juste + nb_mal_places);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
ShowMessage ("Appuyer 4 fois sur lancer");
}
//---------------------------------------------------------------------------
Merci quand même à Meech