Смекни!
smekni.com

Система рейтингового контроля знаний (стр. 6 из 6)

//Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.

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

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

#include <vcl.h>

#pragma hdrstop

#include "RichAbt.h"

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

#pragma resource "*.dfm"

TForm2 *Form2;

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

__fastcall TForm2::TForm2(TComponent *Owner)

: TForm(Owner)

{

}

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

Sort.cpp:

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

#include <vcl&bsol;vcl.h>

#pragma hdrstop

#include "Sort.h"

#include "Datam.h"

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

#pragma resource "*.dfm"

TForm4 *Form4;

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

__fastcall TForm4::TForm4(TComponent* Owner)

: TForm(Owner)

{

}

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

void __fastcall TForm4::ComboBox1Change(TObject *Sender)

{

if (ComboBox1->Text == "L.L.+."){

DM1->Query1->SQL->Clear();

DM1->Query1->SQL->Append("Select * From baza Order by A asc");

DM1->Query1->Open();

DM1->Table1->Open();}

else if (ComboBox1->Text == "Lръєы№ЄхЄ"){

DM1->Query1->SQL->Clear();

DM1->Query1->SQL->Append("Select * From baza Order by W asc");

DM1->Query1->Open();

DM1->Table1->Open();}

else if (ComboBox1->Text == "TяхЎшры№эюёЄ№"){

DM1->Query1->SQL->Clear();

DM1->Query1->SQL->Append("Select * From baza Order by Q asc");

DM1->Query1->Open();

DM1->Table1->Open();}

else if (ComboBox1->Text == "+Ёєяяр"){

DM1->Query1->SQL->Clear();

DM1->Query1->SQL->Append("Select * From baza Order by S asc");

DM1->Query1->Open();

DM1->Table1->Open();}

else if (ComboBox1->Text == "Lръєы№ЄхЄ"){

DM1->Query1->SQL->Clear();

DM1->Query1->SQL->Append("Select * From baza Order by Z asc");

DM1->Query1->Open();

DM1->Table1->Open();}

DM1->Table1->Refresh();

}

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

Unit1.cpp:

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

#include <vcl&bsol;vcl.h>

#pragma hdrstop

#include "Unit1.h"

#include "Datam.h"

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

#pragma link "Grids"

#pragma resource "*.dfm"

TForm3 *Form3;

char predmet1[9]={'H','N','U','J','M','I','K','1','O'};

char predmet2[9]={'E','D','C','R','F','V','T','G','B'};

double ozenka1[12];

int i=0;

double r;

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

__fastcall TForm3::TForm3(TComponent* Owner)

: TForm(Owner)

{

}

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

void __fastcall TForm3::FormCreate(TObject *Sender)

{

//-юсрты хь эютє¦ чряшё№ т срчє

DM1->Table1->Append();

}

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

void __fastcall TForm3::Button1Click(TObject *Sender)

{

if(DM1->Table1->State == dsInsert||DM1->Table1->State == dsEdit)

DM1->Table1->Post();

DM1->Table1->Append();

for(i=0;i<=9;i++){

predmet1[i]=0;}

i=0;

Button5->Enabled=true;

Button2->Enabled=true;

DBEdit8->DataField='x';

DBEdit5->DataField='y';

DBEdit5->ReadOnly=false;

DBEdit8->ReadOnly=false;

DBEdit1->ReadOnly=false;

DBEdit2->ReadOnly=false;

DBEdit4->ReadOnly=false;

DBEdit6->ReadOnly=false;

DBEdit4->Visible=false;

Label8->Visible=false;

DM1->Table1->Refresh();

}

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

void __fastcall TForm3::Button6Click(TObject *Sender)

{

if ( !DM1->Table1->Bof )

DM1->Table1->Prior();

i=10;

}

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

void __fastcall TForm3::Button4Click(TObject *Sender)

{

if ( !DM1->Table1->Eof )

DM1->Table1->Next();

i=10;

}

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

void __fastcall TForm3::Button2Click(TObject *Sender)

{

DM1->Table1->Delete();

DM1->Table1->Refresh();

if(DM1->Table1->Eof && DM1->Table1->Bof )

Button2->Enabled=false;

DBEdit4->Visible=false;

Label8->Visible=false;

}

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

void __fastcall TForm3::Button5Click(TObject *Sender)

{

if(i<=8)

{

int Size = DBEdit8->GetTextLen();

char *name = new char[++Size];

DBEdit8->GetTextBuf(name,Size);

DBEdit8->Text = name;

r=atoi(name);

ozenka1[i]=r;

delete name;

r=0;

DBEdit5->DataField=predmet1[i];

DBEdit8->DataField=predmet2[i];

i++;

Button3->Enabled=true;

}

else {if(i==9){

int Size = DBEdit8->GetTextLen();

char *name = new char[++Size];

DBEdit8->GetTextBuf(name,Size);

DBEdit8->Text = name;

r=atoi(name);

ozenka1[i]=r;

delete name;

r=0;}

ozenka1[10]=(ozenka1[0]+ozenka1[1]+ozenka1[2]+ozenka1[3]+ozenka1[4]+ozenka1[5]+ozenka1[6]+ozenka1[7]+ozenka1[8]+ozenka1[9])/10;

DBEdit4->SelText=ozenka1[10];

DM1->Table1->FieldValues["Z"] = ozenka1[10];

Button5->Enabled=false;

Button3->Enabled=false;

DBEdit5->ReadOnly=true;

DBEdit8->ReadOnly=true;

DBEdit1->ReadOnly=true;

DBEdit2->ReadOnly=true;

DBEdit4->ReadOnly=true;

DBEdit6->ReadOnly=true;

DBEdit4->Visible=true;

Label8->Visible=true;

}}

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

void __fastcall TForm3::Table1AfterOpen(TDataSet *DataSet)

{

if(DM1->Table1->Eof && DM1->Table1->Bof )

Button2->Enabled=false;

}

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

void __fastcall TForm3::Button3Click(TObject *Sender)

{

if(i>=0)

{i--;

DBEdit5->DataField=predmet1[i];

DBEdit8->DataField=predmet2[i];

}

else

Button3->Enabled=false;

Button5->Enabled=true;}

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

Список использованной литературы

1. Трахтенгерц Э.А. «Компьютерная поддержка принятия решений»

2. Том Сван «Программирование в Borland C++ 5.02»

3. «Объектно-ориентированный анализ»

4. Мэт Теллес «Borland С++ Builder»