//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#define INTENTOS 4//numero max de intentos
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
nIntentos = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(Edit1->Text == "dato correcto")
Label1->Caption = "Ha logrado su objetivo";
else
{
if(nIntentos < INTENTOS)
{
nIntentos++;
Label1->Caption = "Le quedan " + IntToStr(INTENTOS - nIntentos) + " Intentos";
}
else
Label1->Caption = "Se le terminaron los intentos...";
}
}
//---------------------------------------------------------------------------