Код программы. Вывод основных уведомлений, страница 8

if (*it == pos) {

povt++;

goto L1;

}

}

if (povt == 0) {

info.old_quest.push_back(pos);

testing->RecNo = pos;

}

}

}

else {

vector<int>::iterator it = info.old_quest.end() - 1;

if (*it == pos) {

goto L1;

}

else {

testing->RecNo = pos;

}

}

cr_pics();

convert_answ(testingTest_ans->AsString);

}

//--------------------------------------------------------------------------void TFtest::get_inf_test(int shablon)

{

// Выбираем нужный шаблон

randomize();

TimeSeparator = ':';

shabl->Close();

shabl->SQL->Clear();

if (id.sr_info != NULL) {

shabl->SQL->Add("select * from \"Shablons\" where \"Type\" = "+IntToStr(id.type_shabl)+" and \"Tema\" = "+IntToStr(id.tema_shabl)+" and \"Sr_info\" = "+IntToStr(id.sr_info));

}

else

shabl->SQL->Add("select * from \"Shablons\" where \"Type\" = "+IntToStr(id.type_shabl)+" and \"Tema\" = "+IntToStr(id.tema_shabl));

shabl->Open();

shabl->First();

shabl->Last();

// Если их несколько – выбираем любой

int pos;

if (shabl->RecordCount > 1) {

pos = random(shabl->RecordCount + 1);

shabl->RecNo = pos;

}

else {

if (shabl->RecordCount == 1) {

shabl->RecNo = 0;

}

else {

Application->MessageBoxA("Не найдены тесты!", "По заданной теме не найдено ни одного теста", MB_OK + MB_ICONSTOP);

end = true;

Close();

}

}

info.first = shablF_level->AsInteger;

info.sec = shablS_level->AsInteger;

info.third = shablT_level->AsInteger;

info.time = shablTime_t->AsInteger;

info.ball = shablMax_b->AsInteger;

info.obsh = shablO_level->AsInteger;

info.type_shabl = shablType->AsInteger;

info.sr_info = shablSr_info->AsInteger;

info.shablon = shablSh->AsInteger;

switch (info.time) {

case 15: {

info.time_ost_m = 15;

info.time_ost_s = 0;

Timer1->Enabled = true;

break;

}

case 20: {

info.time_ost_m = 20;

info.time_ost_s = 0;

Timer1->Enabled = true;

break;

}

case 25: {

info.time_ost_m = 25;

info.time_ost_s = 0;

Timer1->Enabled = true;

break;

}

case 30: {

info.time_ost_m = 30;

info.time_ost_s = 0;

Timer1->Enabled = true;

break;

}

default : {

Label1->Caption = "Осталось : Время не ограничено";

Timer1->Enabled = false;

break;

}

}

testing->Close();

testing->SQL->Clear();

if ((shablF_level->AsInteger > 0) || (shablS_level->AsInteger > 0)

|| (shablT_level->AsInteger > 0)) {

info.kol_nado = shablF_level->AsInteger + shablS_level->AsInteger + shablT_level->AsInteger;

}

if (shablO_level->AsInteger > 0) {

info.kol_nado = shablO_level->AsInteger;

}

}

//--------------------------------------------------------------------------void __fastcall TFtest::FormCloseQuery(TObject *Sender, bool &CanClose)

{

if (end) {

CanClose = true;

}

else {

if (Application->MessageBoxA("Прервать сеанс тестирования?", "Тестирование", MB_YESNO + MB_ICONQUESTION) == IDYES) {

CanClose = true;

}

else {

CanClose = false;

}

}

}

//--------------------------------------------------------------------------void __fastcall TFtest::FormActivate(TObject *Sender)

{

LongTimeFormat = "hh:mm";

sozd = false;

kol_was = 0;

get_inf_test(nshabl);

ins_test();

end = false;

}

//--------------------------------------------------------------------------void __fastcall TFtest::FormClose(TObject *Sender, TCloseAction &Action)

{

Transaction1->CommitRetaining();

DB1->Connected = false;

Transaction1->Active = false;

}

//--------------------------------------------------------------------------void __fastcall TFtest::Button1Click(TObject *Sender)

{

}

//--------------------------------------------------------------------------void __fastcall TFtest::Timer1Timer(TObject *Sender)