ОБСУЖДЕНИЕ

Курсовая Тест «таблицы Шульте»

1 ответов 5,1 тыс.
AI-выжимка обсуждения скоро

Краткие тезисы обсуждения со ссылками на ключевые ответы появятся здесь.

Автор темы
код на первый из пяти квадратов...каждый раз програма позволяет разблокировать разное количество кнопок...что делать?...надо свежый взгляд...!!!а то идей уже нет!!!

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TButton *butt[25];
int mas[25];
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::end(TObject *Sender)
{
Timer1->Enabled=false;
}
void __fastcall TForm1::next(TObject *Sender)
{
int i=((TButton *) Sender)->Tag;
int j=0;
for(;j<25;j++)
if(butt[j]->Tag==i+1) break;
butt[j]->Enabled=true;
butt[mas]->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::start(TObject *Sender)
{
Timer1->Enabled=true;
Button1->Visible=false;
next(Form1);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for(int i=0;i<25;i++)
mas=i;
randomize();
for(int i=0;i<25;i++)
{
int temp=mas;
int r=rand()%25;
mas=mas[r];
mas[r]=temp;
}
for(int i=0;i<25;i++)
{
butt=new TButton(this);
butt->Parent=Form1;
butt->Top=36*(i/5);
butt->Left=i*36%(36*5);
butt->Height=36;
butt->Width=36;
butt->Font->Name="Giddyup Std";
butt->Font->Size=15;
butt->Caption=IntToStr(mas+1);
butt->Tag=mas;
butt->OnClick=next;
butt->Enabled=false;
butt->Visible=true;
}
for(int i=0;i<25;i++)
{
if(mas==0)
{
butt->Enabled=true;
butt->OnClick=start;
}
if(mas==24)
butt->OnClick=end;
}


}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Label1->Caption=IntToStr(StrToInt(Label1->Caption)+1);
}
 
вот к чему я пришел..у кого есть какие идеи что бы оптимизировать работу програмы...отписывайте плис...
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TButton *butt[25];
int mas[25];
int vremiy[5];
int p=0;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::end(TObject *Sender)
{
Timer1->Enabled=false;
vremiy[p]=StrToInt(Label1->Caption);
p++;
Button1->Visible=true;
Button1->Caption="Початок тесту.Крок №"+IntToStr(p+1);
switch(p)
{
case 1:Label2->Caption="Час кроку 1:"+Label1->Caption;break;
case 2:Label3->Caption="Час кроку 2:"+Label1->Caption;break;
case 3:Label4->Caption="Час кроку 3:"+Label1->Caption;break;
case 4:Label5->Caption="Час кроку 4:"+Label1->Caption;break;
case 5:Label6->Caption="Час кроку 5:"+Label1->Caption;break;
}
Label1->Caption=0;
}
void __fastcall TForm1::next(TObject *Sender)
{
int i=((TButton *) Sender)->Tag;
int j=0;
for(j;j<25;j++)
if(butt[j]->Tag==i+1) break;
butt[j]->Enabled=true;
//butt[mas[j]]->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::start(TObject *Sender)
{
Timer1->Enabled=true;
Button1->Visible=false;
next(Form1);
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button1->Visible=false;
for(int i=0;i<25;i++)
mas=i;
randomize();
for(int i=0;i<25;i++)
{
int temp=mas;
int r=rand()%25;
mas=mas[r];
mas[r]=temp;
}
for(int i=0;i<25;i++)
{
butt=new TButton(this);
butt->Parent=Form1;
butt->Top=36*(i/5);
butt->Left=i*36%(36*5);
butt->Height=36;
butt->Width=36;
butt->Font->Name="Giddyup Std";
butt->Font->Size=15;
butt->Caption=IntToStr(mas+1);
butt->Tag=mas;
butt->OnClick=next;
butt->Enabled=false;
butt->Visible=true;
}
for(int i=0;i<25;i++)
{
if(mas==0)
{
butt->Enabled=true;
butt->OnClick=start;
}
if(mas==24)
butt->OnClick=end;
}


}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Label1->Caption=IntToStr(StrToInt(Label1->Caption)+1);
}