Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.Menus;
- type
- TStudent = record
- Surname: String[20];
- Number: Integer;
- Discipline: String[20];
- Grade: Real;
- end;
- TArrRecord = array of TStudent;
- TMainForm = class(TForm)
- StringGridList: TStringGrid;
- ButtonAdd: TButton;
- ButtonInfo: TButton;
- Label1: TLabel;
- ComboBox1: TComboBox;
- MainMenu1: TMainMenu;
- F: TMenuItem;
- Task: TMenuItem;
- Instruction: TMenuItem;
- Developer: TMenuItem;
- OpenF: TMenuItem;
- SaveF: TMenuItem;
- N7: TMenuItem;
- Exit: TMenuItem;
- OpenDialog1: TOpenDialog;
- SaveDialog1: TSaveDialog;
- procedure FormCreate(Sender: TObject);
- procedure ButtonAddClick(Sender: TObject);
- procedure StringGridListDblClick(Sender: TObject);
- procedure StringGridListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure ButtonInfoClick(Sender: TObject);
- procedure ComboBox1Change(Sender: TObject);
- procedure StringGridListKeyPress(Sender: TObject; var Key: Char);
- procedure OpenFClick(Sender: TObject);
- procedure SaveFClick(Sender: TObject);
- procedure TaskClick(Sender: TObject);
- procedure InstructionClick(Sender: TObject);
- procedure DeveloperClick(Sender: TObject);
- procedure ExitClick(Sender: TObject);
- procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- const
- SIZE = 8;
- var
- MainForm: TMainForm;
- ArrRecord: TArrRecord;
- Path: String;
- IsFileOpen: Boolean;
- implementation
- {$R *.dfm}
- uses Unit2, Unit3, Unit4;
- procedure TMainForm.ButtonAddClick(Sender: TObject);
- var
- Add: Word;
- Student: TStudent;
- I, J: Byte;
- IsCorrect: Boolean;
- begin
- Add := AddForm.ShowModal;
- If Add = mrOk Then
- Begin
- J := StringGridList.RowCount;
- StringGridList.RowCount := StringGridList.RowCount + 1;
- SetLength(ArrRecord, J);
- ArrRecord[J - 1].Surname := AddForm.EditName.Text;
- ArrRecord[J - 1].Number := StrToInt(AddForm.ComboBoxGroup.Text);
- ArrRecord[J - 1].Discipline := AddForm.ComboBoxDisc.Text;
- ArrRecord[J - 1].Grade := StrToFloat(AddForm.EditGrade.Text);
- IsCorrect := True;
- For I := 1 to StringGridList.RowCount do
- Begin
- If StringGridList.Cells[0, I] = ArrRecord[J - 1].Surname Then
- Begin
- If StringGridList.Cells[1, I] = IntToStr(ArrRecord[J - 1].Number) Then
- Begin
- if StringGridList.Cells[2, I] = ArrRecord[J - 1].Discipline then
- Begin
- If StringGridList.Cells[3, I] = FloatToStr(ArrRecord[J - 1].Grade) Then
- Begin
- IsCorrect := False;
- break;
- End;
- End;
- End;
- End;
- End;
- If IsCorrect Then
- Begin
- StringGridList.Cells[0, J] := ArrRecord[J - 1].Surname;
- StringGridList.Cells[1, J] := IntToStr(ArrRecord[J - 1].Number);
- StringGridList.Cells[2, J] := ArrRecord[J - 1].Discipline;
- StringGridList.Cells[3, J] := FloatToStr(ArrRecord[J - 1].Grade);
- End
- Else
- Begin
- For I := J to StringGridList.RowCount - 2 do
- Begin
- StringGridList.Cells[0, I] := StringGridList.Cells[0, I + 1];
- StringGridList.Cells[1, I] := StringGridList.Cells[1, I + 1];
- StringGridList.Cells[2, I] := StringGridList.Cells[2, I + 1];
- StringGridList.Cells[3, I] := StringGridList.Cells[3, I + 1];
- End;
- StringGridList.RowCount := StringGridList.RowCount - 1;
- SetLength(ArrRecord, StringGridList.RowCount - 1);
- For I := 0 to StringGridList.RowCount - 2 do
- Begin
- ArrRecord[I].Surname := StringGridList.Cells[0, I + 1];
- ArrRecord[I].Number := StrToInt(StringGridList.Cells[1, I + 1]);
- ArrRecord[I].Discipline := StringGridList.Cells[2, I + 1];
- ArrRecord[I].Grade := StrToFloat(StringGridList.Cells[3, I + 1]);
- End;
- End;
- AddForm.EditName.Clear;
- AddForm.ComboBoxGroup.ClearSelection;
- AddForm.ComboBoxDisc.ClearSelection;
- AddForm.EditGrade.Clear;
- SaveF.Enabled := True;
- End;
- end;
- procedure TMainForm.ButtonInfoClick(Sender: TObject);
- var
- I, J, Count: Integer;
- Form4: TInfoForm;
- begin
- Form4 := TInfoForm.Create(nil);
- try
- Form4.Show;
- finally
- end;
- end;
- procedure TMainForm.ComboBox1Change(Sender: TObject);
- var
- I, J, Count: Integer;
- Str: String[20];
- begin
- Count := 0;
- For J := 0 to StringGridList.RowCount - 2 do
- Begin
- If ArrRecord[J].Discipline = ComboBox1.Text Then
- Inc(Count)
- Else
- ButtonInfo.Enabled := False;
- End;
- If Count <> 0 Then
- ButtonInfo.Enabled := True
- Else
- ButtonInfo.Enabled := False;
- End;
- procedure TMainForm.DeveloperClick(Sender: TObject);
- begin
- Application.MessageBox('Выполнил студент группы 251004, Сымоник Вадим', 'О разработчике', 0)
- end;
- procedure TMainForm.ExitClick(Sender: TObject);
- begin
- MainForm.Close;
- end;
- procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
- begin
- CanClose := Application.MessageBox('Вы действительно хотите выйти?', 'Выход', MB_YESNO + MB_ICONQUESTION) = ID_YES;
- end;
- procedure TMainForm.FormCreate(Sender: TObject);
- var I, J: Integer;
- begin
- J := 0;
- StringGridList.Cells[0, J] := 'фамилия';
- StringGridList.Cells[1, J] := 'номер группы';
- StringGridList.Cells[2, J] := 'дисциплина';
- StringGridList.Cells[3, J] := 'средний балл';
- end;
- procedure TMainForm.InstructionClick(Sender: TObject);
- const
- Str1 = '1. Нажмите "добавить студента" чтобы добавить новую запись.';
- Str2 = #13#10'2. Кликните 2 раза по строке, чтобы редактировать её.';
- Str3 = #13#10'3. Чтобы удалить строку выберите её и нажмите Delete.';
- Str4 = #13#10'4. Вы можете соханить данные в файл или открыть файл.';
- Str5 = #13#10'5. Выберите дисциплину, которая будет читаться, чтобы отобразить'#13#10'информацию о студентах.';
- Str6 = #13#10'6. Если количество студентов превышает 8 человек, тогда будут отобраны'#13#10'студенты с большим средним баллом.';
- begin
- Application.MessageBox(Str1 + Str2 + Str3 + Str4 + Str5 + Str6, 'Инструкция', 0);
- end;
- procedure TMainForm.OpenFClick(Sender: TObject);
- var
- F: File of TStudent;
- I, Count: Integer;
- begin
- Count := 0;
- I := 0;
- AssignFile(F, Path);
- If(OpenDialog1.Execute) Then
- Begin
- Try
- StringGridList.RowCount := 1;
- Path := OpenDialog1.FileName;
- Reset(F, Path);
- If FileSize(F) <> 0 Then
- Begin
- Finalize(ArrRecord);
- SetLength(ArrRecord, FileSize(F));
- For I := 0 to FileSize(F) - 1 do
- Begin
- Read(F, ArrRecord[I]);
- Inc(Count);
- End;
- StringGridList.RowCount := Count + 1;
- For I := 0 to Count - 1 do
- Begin
- StringGridList.Cells[0, I + 1] := ArrRecord[I].Surname;
- StringGridList.Cells[1, I + 1] := IntToStr(ArrRecord[I].Number);
- StringGridList.Cells[2, I + 1] := ArrRecord[I].Discipline;
- StringGridList.Cells[3, I + 1] := FloatToStr(ArrRecord[I].Grade);
- End;
- SaveF.Enabled := True;
- End;
- CloseFile(F);
- Except
- Application.MessageBox('Некорректный файл!', 'Ошибка', MB_ICONSTOP);
- End;
- End;
- end;
- procedure TMainForm.SaveFClick(Sender: TObject);
- var
- F: File of TStudent;
- I: Integer;
- Str: String;
- begin
- If (SaveDialog1.Execute) Then
- Begin
- Try
- Path := SaveDialog1.FileName;
- Str := ExtractFileExt(Path);
- If(Str = '') Then
- Path := Path + '.dat';
- AssignFile(F, path);
- Rewrite(F, Path);
- Seek(F, 0);
- Truncate(F);
- For I := 0 To Length(ArrRecord) - 1 Do
- Begin
- Write(F, ArrRecord[I]);
- End;
- CloseFile(F);
- Except
- Application.MessageBox('Некорректный файл!', 'Ошибка', MB_ICONSTOP);
- End;
- End;
- end;
- procedure TMainForm.StringGridListDblClick(Sender: TObject);
- var
- Student: TStudent;
- EditForm: TEditForm;
- Edit: Word;
- I, J, SelectedRow: Integer;begin
- J := 0;
- SelectedRow := StringGridList.Row;
- if SelectedRow > 0 Then
- Begin
- EditForm := TEditForm.Create(nil);
- try
- EditForm.EditName.Text := ArrRecord[SelectedRow - 1].Surname;
- EditForm.ComboBoxGroup.Text := IntToStr(ArrRecord[SelectedRow - 1].Number);
- EditForm.ComboBoxDisc.Text := ArrRecord[SelectedRow - 1].Discipline;
- EditForm.EditGrade.Text := FloatToStr(ArrRecord[SelectedRow - 1].Grade);
- if EditForm.ShowModal = mrOK then
- Begin
- ArrRecord[SelectedRow - 1].Surname := EditForm.EditName.Text;
- ArrRecord[SelectedRow - 1].Number := StrToInt(EditForm.ComboBoxGroup.Text);
- ArrRecord[SelectedRow - 1].Discipline := EditForm.ComboBoxDisc.Text;
- ArrRecord[SelectedRow - 1].Grade := StrToFloat(EditForm.EditGrade.Text);
- StringGridList.Cells[0, SelectedRow] := ArrRecord[SelectedRow - 1].Surname;
- StringGridList.Cells[1, SelectedRow] := IntToStr(ArrRecord[SelectedRow - 1].Number);
- StringGridList.Cells[2, SelectedRow] := ArrRecord[SelectedRow - 1].Discipline;
- StringGridList.Cells[3, SelectedRow] := FloatToStr(ArrRecord[SelectedRow - 1].Grade);
- End;
- finally
- EditForm.Free;
- end;
- End;
- end;
- procedure TMainForm.StringGridListKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var
- SelectedRow, I: Integer;
- Student: TStudent;
- begin
- If Key = VK_DELETE Then
- Begin
- SelectedRow := StringGridList.Row;
- If SelectedRow > 0 Then
- Begin
- If Application.MessageBox('Вы действительно хотите удалить строку?', 'Удалить строку', MB_YESNO + MB_ICONQUESTION) = ID_YES Then
- Begin
- Student.Surname := StringGridList.Cells[0, SelectedRow];
- Student.Number := StrToInt(StringGridList.Cells[1, SelectedRow]);
- Student.Discipline := StringGridList.Cells[2, SelectedRow];
- Student.Grade := StrToFloat(StringGridList.Cells[3, SelectedRow]);
- StringGridList.Rows[SelectedRow].Clear;
- For I := SelectedRow to StringGridList.RowCount - 2 do
- Begin
- StringGridList.Cells[0, I] := StringGridList.Cells[0, I + 1];
- StringGridList.Cells[1, I] := StringGridList.Cells[1, I + 1];
- StringGridList.Cells[2, I] := StringGridList.Cells[2, I + 1];
- StringGridList.Cells[3, I] := StringGridList.Cells[3, I + 1];
- End;
- StringGridList.RowCount := StringGridList.RowCount - 1;
- SetLength(ArrRecord, StringGridList.RowCount - 1);
- For I := 0 to StringGridList.RowCount - 2 do
- Begin
- ArrRecord[I].Surname := StringGridList.Cells[0, I + 1];
- ArrRecord[I].Number := StrToInt(StringGridList.Cells[1, I + 1]);
- ArrRecord[I].Discipline := StringGridList.Cells[2, I + 1];
- ArrRecord[I].Grade := StrToFloat(StringGridList.Cells[3, I + 1]);
- End;
- End;
- End;
- End;
- If (StringGridList.RowCount > 1) And (ComboBox1.Text <> '') Then
- ButtonInfo.Enabled := True
- Else
- ButtonInfo.Enabled := False;
- If StringGridList.RowCount = 1 Then
- SaveF.Enabled := False;
- end;
- procedure TMainForm.StringGridListKeyPress(Sender: TObject; var Key: Char);
- begin
- Key := #0;
- end;
- procedure TMainForm.TaskClick(Sender: TObject);
- begin
- Application.MessageBox('Сведения о том, какие из пяти, предлагаемых дисциплин по выбору, желает слушать студент', 'Условие', 0)
- end;
- end.
- unit Unit2;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus;
- type
- TAddForm = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- EditName: TEdit;
- EditGrade: TEdit;
- ComboBoxDisc: TComboBox;
- ButtonOk: TButton;
- ButtonNo: TButton;
- ComboBoxGroup: TComboBox;
- MainMenu1: TMainMenu;
- N1: TMenuItem;
- N2: TMenuItem;
- procedure ButtonOkClick(Sender: TObject);
- procedure ButtonNoClick(Sender: TObject);
- procedure EditGradeChange(Sender: TObject);
- procedure EditGradeKeyPress(Sender: TObject; var Key: Char);
- procedure ComboBoxDiscChange(Sender: TObject);
- procedure EditNameChange(Sender: TObject);
- procedure ComboBoxGroupChange(Sender: TObject);
- procedure N2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- AddForm: TAddForm;
- Bol1, Bol2, Bol3, Bol4: Boolean;
- implementation
- {$R *.dfm}
- procedure TAddForm.ButtonNoClick(Sender: TObject);
- begin
- ModalResult := mrNo;
- end;
- procedure TAddForm.ButtonOkClick(Sender: TObject);
- begin
- ModalResult := mrOk;
- end;
- procedure TAddForm.ComboBoxDiscChange(Sender: TObject);
- begin
- if ComboBoxDisc.ItemIndex > -1 then
- Bol3 := True
- Else
- Bol3 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonOk.Enabled := True;
- End
- Else
- ButtonOk.Enabled := False;
- end;
- procedure TAddForm.ComboBoxGroupChange(Sender: TObject);
- begin
- if ComboBoxGroup.ItemIndex > -1 then
- Bol2 := True
- Else
- Bol2 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonOk.Enabled := True;
- End
- Else
- ButtonOk.Enabled := False;
- end;
- procedure TAddForm.EditGradeChange(Sender: TObject);
- var
- Num: Real;
- begin
- Bol4 := True;
- Try
- Num := StrToFloat(EditGrade.Text);
- Except
- Bol4 := False;
- EditGrade.Text := '';
- End;
- If Bol4 And ((Num > 10.0) Or (Num < 1.0)) Then
- Begin
- Bol4 := False;
- EditGrade.Text := '';
- End;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonOk.Enabled := True;
- End
- Else
- ButtonOk.Enabled := False;
- end;
- procedure TAddForm.EditGradeKeyPress(Sender: TObject; var Key: Char);
- begin
- If not (key in ['0'..'9', ',', #8, #13]) Then Key := #0;
- end;
- procedure TAddForm.EditNameChange(Sender: TObject);
- begin
- If EditName.Text <> '' Then
- Bol1 := True
- Else
- Bol1 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonOk.Enabled := True;
- End
- Else
- ButtonOk.Enabled := False;
- end;
- procedure TAddForm.N1Click(Sender: TObject);
- const
- Str1 = '1. Заполните все поля.';
- Str2 = #13#10'2. Максимальная длина фамилии - 20 символов.';
- Str3 = #13#10'3. Диапазон ввода среднего балла от 1.0 до 10.0';
- Str4 = #13#10' если будет введено число не из диапазона, поле очистится. ';
- begin
- Application.MessageBox(Str1 + Str2 + Str3 + Str4, 'Инструкция', 0)
- end;
- procedure TAddForm.N2Click(Sender: TObject);
- begin
- Application.MessageBox('Выполнил студент группы 251004, Сымоник Вадим', 'О разработчике', 0)
- end;
- end.
- unit Unit3;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus;
- type
- TEditForm = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- EditName: TEdit;
- EditGrade: TEdit;
- ComboBoxDisc: TComboBox;
- ButtonEdit: TButton;
- ButtonCancel: TButton;
- ComboBoxGroup: TComboBox;
- MainMenu1: TMainMenu;
- N1: TMenuItem;
- N2: TMenuItem;
- procedure ButtonEditClick(Sender: TObject);
- procedure ButtonCancelClick(Sender: TObject);
- procedure EditNameChange(Sender: TObject);
- procedure ComboBoxGroupChange(Sender: TObject);
- procedure ComboBoxDiscChange(Sender: TObject);
- procedure EditGradeChange(Sender: TObject);
- procedure EditGradeKeyPress(Sender: TObject; var Key: Char);
- procedure N2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- EditForm: TEditForm;
- Bol1, Bol2, Bol3, Bol4: Boolean;
- implementation
- {$R *.dfm}
- procedure TEditForm.ButtonCancelClick(Sender: TObject);
- begin
- ModalResult := mrNo;
- end;
- procedure TEditForm.ButtonEditClick(Sender: TObject);
- begin
- ModalResult := mrOk;
- end;
- procedure TEditForm.ComboBoxDiscChange(Sender: TObject);
- begin
- if ComboBoxDisc.ItemIndex > -1 then
- Bol3 := True
- Else
- Bol3 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonEdit.Enabled := True;
- End
- Else
- ButtonEdit.Enabled := False;
- end;
- procedure TEditForm.ComboBoxGroupChange(Sender: TObject);
- begin
- if ComboBoxGroup.ItemIndex > -1 then
- Bol2 := True
- Else
- Bol2 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonEdit.Enabled := True;
- End
- Else
- ButtonEdit.Enabled := False;
- end;
- procedure TEditForm.EditGradeChange(Sender: TObject);
- var
- Num: Real;
- begin
- Bol4 := True;
- Try
- Num := StrToFloat(EditGrade.Text);
- Except
- Bol4 := False;
- EditGrade.Text := '';
- End;
- If (Num > 10.0) Or (Num < 1.0) Then
- Begin
- Bol4 := False;
- EditGrade.Text := '';
- End;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonEdit.Enabled := True;
- End
- Else
- ButtonEdit.Enabled := False;
- end;
- procedure TEditForm.EditGradeKeyPress(Sender: TObject; var Key: Char);
- begin
- If not (key in ['0'..'9', ',', #8, #13]) Then Key := #0;
- end;
- procedure TEditForm.EditNameChange(Sender: TObject);
- begin
- If EditName.Text <> '' Then
- Bol1 := True
- Else
- Bol1 := False;
- If (Bol1 = True) And (Bol2 = True) And (Bol3 = True) And (Bol4 = True) Then
- Begin
- ButtonEdit.Enabled := True;
- End
- Else
- ButtonEdit.Enabled := False;
- end;
- procedure TEditForm.N1Click(Sender: TObject);
- const
- Str1 = '1. Все поля должны быть заполнены, чтобы нажать "редактировать".';
- Str2 = #13#10'2. Максимальная длина фамилии - 20 символов.';
- Str3 = #13#10'3. Диапазон ввода среднего балла от 1.0 до 10.0';
- Str4 = #13#10' если будет введено число не из диапазона, поле очистится.';
- begin
- Application.MessageBox(Str1 + Str2 + Str3 + Str4, 'Инструкция', 0)
- end;
- procedure TEditForm.N2Click(Sender: TObject);
- begin
- Application.MessageBox('Выполнил студент группы 251004, Сымоник Вадим', 'О разработчике', 0)
- end;
- end.
- unit Unit4;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls, Unit1,
- Vcl.Menus;
- type
- TNewStud = record
- Surname: String[20];
- Group: Integer;
- Disc: String[20];
- Grade: Real;
- end;
- TArrStud = array of TNewStud;
- TInfoForm = class(TForm)
- StringGridInfo: TStringGrid;
- LabelInfo: TLabel;
- MainMenu1: TMainMenu;
- N1: TMenuItem;
- N2: TMenuItem;
- procedure FormCreate(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure N2Click(Sender: TObject);
- procedure N1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- const
- SIZE = 8;
- var
- InfoForm: TInfoForm;
- NewStud: TArrStud;
- implementation
- {$R *.dfm}
- procedure TInfoForm.FormCreate(Sender: TObject);
- var
- I, J, CountRow: Integer;
- begin
- LabelInfo.Caption := LabelInfo.Caption + ' "' + MainForm.ComboBox1.Text + '"';
- StringGridInfo.Cells[0, 0] := 'фамилия';
- StringGridInfo.Cells[1, 0] := 'номер группы';
- StringGridInfo.Cells[2, 0] := 'средний балл';
- SetLength(NewStud, MainForm.StringGridList.RowCount - 1);
- end;
- procedure SortGrade(var arr: TArrStud);
- var
- i, j: integer;
- temp: TNewStud;
- begin
- for i := 0 to High(arr) - 1 do
- begin
- for j := 0 to High(arr) - i - 1 do
- begin
- if arr[j].Grade < arr[j + 1].Grade then
- begin
- temp := arr[j];
- arr[j] := arr[j + 1];
- arr[j + 1] := temp;
- end;
- end;
- end;
- end;
- procedure TInfoForm.FormShow(Sender: TObject);
- var
- I, Count, J: Integer;
- begin
- I := 0;
- For J := 0 to MainForm.StringGridList.RowCount - 1 do
- Begin
- If ArrRecord[J].Discipline = MainForm.ComboBox1.Text Then
- Begin
- NewStud[I].Surname := ArrRecord[J].Surname;
- NewStud[I].Group := ArrRecord[J].Number;
- NewStud[I].Grade := ArrRecord[J].Grade;
- Inc(I);
- End;
- End;
- Count := I;
- StringGridInfo.RowCount := Count + 1;
- SortGrade(NewStud);
- If Count < SIZE Then
- Begin
- For J := 0 to StringGridInfo.RowCount - 1 do
- Begin
- StringGridInfo.Cells[0, J + 1] := NewStud[J].Surname;
- StringGridInfo.Cells[1, J + 1] := IntToStr(NewStud[J].Group);
- StringGridInfo.Cells[2, J + 1] := FloatToStr(NewStud[J].Grade);
- End;
- End
- Else
- Begin
- StringGridInfo.RowCount := SIZE + 1;
- For J := 0 to SIZE - 1 do
- Begin
- StringGridInfo.Cells[0, J + 1] := NewStud[J].Surname;
- StringGridInfo.Cells[1, J + 1] := IntToStr(NewStud[J].Group);
- StringGridInfo.Cells[2, J + 1] := FloatToStr(NewStud[J].Grade);
- End;
- End;
- end;
- procedure TInfoForm.N1Click(Sender: TObject);
- const
- Str1 = '1. Здесь отображена информация о студентах желающих прослушать'#13#10'данную дисциплину';
- Str2 = #13#10'2. Студенты выведены по успеваемости:';
- Str3 = #13#10' от большего среднего балла к меньшему.';
- Str4 = #13#10'3. Максимальное количество студентов равно 8.';
- begin
- Application.MessageBox(Str1 + Str2 + Str3 + Str4, 'Инструкция', 0)
- end;
- procedure TInfoForm.N2Click(Sender: TObject);
- begin
- Application.MessageBox('Выполнил студент группы 251004, Сымоник Вадим', 'О разработчике', 0)
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement