Написание программы с использованием команд void prepod_see(int n), void admin_see(), void students_see(), void not_see2(bool t), страница 11

void Show_vopros(int n_v,int f);

AnsiString GetDir();

int nomer_str=0;

void add_info_reg(int f);

int vop2,otv2,prochent;

void s_itog(int v, int o);

int GEN_vuborka();

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm7 *Form7;

//---------------------------------------------------------------------------

__fastcall TForm7::TForm7(TComponent* Owner)

        : TForm(Owner)

{ }

//---------------------------------------------------------------------------

void s_itog(int v, int o)

{vop2=v;

 otv2=o;

if(vop2!=0)prochent=otv2/vop2;

}

void add_info_reg(int f)

{AnsiString s='\0',p='\0',dat,timee,a;

if(f==0){int i;

         s=Form3->Memo2->Lines->Strings[0].c_str();

         for(i=0;s[1]!='@';i++)

             {s=Form3->Memo2->Lines->Strings[i+1].c_str();

             }

         nomer_str=i;

        }

dat=FormatDateTime("dd.mm.yyyy",Now());

timee=FormatDateTime("hh.nn",Now());

p=Form7->Edit1->Text.c_str();

p=p+'/'+dat+" в "+timee;

p=p+'/'+Form7->Edit2->Text.c_str()+'/';

p=p+Form7->Edit3->Text.c_str()+'/'+Form7->Edit4->Text.c_str()+'/';

if(f==0){p=p+"0/0/0";}

if(f==1){a=IntToStr(vop2);p=p+a+'/';a=IntToStr(otv2);p=p+a+'/';prochent=100*otv2/vop2;a=IntToStr(prochent);p=p+a+'/';}

Form3->Memo2->Lines->Strings[nomer_str]=p;

if(f==0)Form3->Memo2->Lines->Add("@");

}

void __fastcall TForm7::Button1Click(TObject *Sender)

{AnsiString s,p,t2;

 if(Form7->ListBox1->ItemIndex!=-1)

   {if(Form7->Edit1->Text!="")

      {if(Form7->Edit2->Text!="")

          {if(Form7->Edit3->Text!="")

              {if(Form7->Edit4->Text!="")

                 {s=Form7->ListBox1->Items->Strings[ListBox1->ItemIndex];

                  t2=p=GetDir();

                  p=p+"БД\\"+s+".txt";

                  t2=t2+"БД\\s_"+s+".txt";

                  not_see4();

                  Form3->Memo1->Lines->LoadFromFile(p);

                  Form3->Memo2->Lines->LoadFromFile(t2);

                  add_info_reg(0);

                  Show_vopros(GEN_vuborka(),3); //????????????????//

                  Form4->Show();

                  Form7->Close();

                  Form7->Button1->Visible=false;

                  Form3->Memo2->Lines->SaveToFile(t2);

                 }else ShowMessage("Введите свою учебную Группу");

              } else ShowMessage("Введите ваше отчетво");

          } else ShowMessage("Введите своё имя");

     }  else ShowMessage("Введите свою Фамилию");

 }else ShowMessage("Выберете предмет");

}

//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit8.h"

#include "Unit3.h"

#include "Unit5.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm8 *Form8;

//---------------------------------------------------------------------------

__fastcall TForm8::TForm8(TComponent* Owner)

        : TForm(Owner)

{

}

void Show_statistik(int n_s)

{int i1,i2,i3,i4,i5,i6,i7,i8;

 AnsiString s,p="";

 s=Form3->Memo2->Lines->Strings[n_s].c_str();

      for(i1=1;s[i1]!='/';i1++)

          {p=p+s[i1];}

     // Form8->Edit1->Text="xxx";

      Form8->Edit1->Text=p;p="";

      for(i2=i1+1;s[i2]!='/';i2++)

          {p=p+s[i2];}

      Form8->Edit5->Text=p;p="";

      for(i3=i2+1;s[i3]!='/';i3++)

          {p=p+s[i3];}

      Form8->Edit2->Text=p;p="";

      for(i4=i3+1;s[i4]!='/';i4++)

          {p=p+s[i4];}

      Form8->Edit3->Text=p;p="";

      for(i5=i4+1;s[i5]!='/';i5++)

          {p=p+s[i5];}

      Form8->Edit4->Text=p;p="";

      for(i6=i5+1;s[i6]!='/';i6++)

          {p=p+s[i6];}

      if(p!='0')

     {Form8->Edit6->Text=p;p="";

       for(i7=i6+1;s[i7]!='/';i7++)

          {p=p+s[i7];}

       Form8->Edit7->Text=p;p="";

       for(i8=i7+1;s[i8]!='/';i8++)

          {p=p+s[i8];}

       p=p+'%';  

       Form8->Edit8->Text=p;p="";

     }

     else {Form8->Edit6->Text="Не закончил тест";

           Form8->Edit7->Text="Не закончил тест";

           Form8->Edit8->Text="Не закончил тест";

                }

     // Form8->Edit4->Text=Form2->ListBox1->Items->Strings[n];

}

//---------------------------------------------------------------------------

void __fastcall TForm8::Button1Click(TObject *Sender)

{

  Form8->Close();//возврат на главную форму

  Form5->Show();

 // Form3->Edit29->Enabled=false;

 // Form3->Button7->Visible=false;

 // Form3->Edit23->Text="1";//(ВРЕМЕННО) номер вопроса вБД

 // add=0;

}

//---------------------------------------------------------------------------

void __fastcall TForm8::ListBox1Click(TObject *Sender)

{if(Form8->ListBox1->ItemIndex>=0)Show_statistik(Form8->ListBox1->ItemIndex);}

//---------------------------------------------------------------------------