Показать сообщение отдельно
  #3  
Старый 04.05.2008, 19:48
Димка Сидоров Димка Сидоров вне форума
Прохожий
 
Регистрация: 02.05.2008
Сообщения: 4
Репутация: 10
По умолчанию

А код в общем-то простой. Пока всё на что меня хватило. Здесь пока взял 4 команды добавить больше проблем нет. Как и осуществить подсчёт забитых и пропущенных мячей. Главное не придумаю как осуществить суммирование очков после каждого ввода результатов. Ничего не выходит.
Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls;

type
  TForm1 = class(TForm)
    tabl: TStringGrid;
    Button1: TButton;
    procedure FormActive(Sender:TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
        {$R *.dfm}
uses Unit2;
        
       procedure TForm1.FormActive(Sender:TObject);
   begin
   tabl.Cells[0,3]:='Спартак';
   tabl.Cells[0,2]:='Рубин';
   tabl.Cells[0,1]:='Зенит;
   tabl.Cells[0,4]:='Динамо';
   tabl.Cells[1,0]:='Очки';
   tabl.Cells[2,0]:='Игры';
   tabl.Cells[3,0]:='Победы';
   tabl.Cells[4,0]:='Ничьи';
   tabl.Cells[5,0]:='Поражения';
   end;
procedure TForm1.Button1Click(Sender: TObject);
      begin
              Form2.Show;
         end;
         end.
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm2 = class(TForm)
    StringGrid1: TStringGrid;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}
   uses unit1;
procedure TForm2.Button2Click(Sender: TObject);
  var
 s,i,l,j: integer;
begin
         for j:=1 to 2 do
         begin
              s:=0;
              l:=0;
    if StrToInt(StringGrid1.Cells[1,j])>StrToInt(StringGrid1.Cells[2,j])
     then s:=s+3
     else if StrToInt(StringGrid1.Cells[1,j])<StrToInt(StringGrid1.Cells[2,j])
        then l:=l+3
                         else begin s:=s+1;
                                     l:=l+1;
                                   end;
       for i:=1 to 4 do
             begin
             if Form1.tabl.Cells[0,i]=StringGrid1.Cells[0,j]
                   then Form1.tabl.Cells[1,i]:=IntToStr(s);
                       end;
                  for i:=1 to 4 do
         begin
                  if Form1.tabl.Cells[0,i]=StringGrid1.Cells[3,j]
         then Form1.tabl.Cells[1,i]:=IntToStr(l);
           end;
            end;
             Form1.Show;
            end;
 end.

Admin: Пользуемся тегами для оформления кода, иначе последуют санкции!

Посоветуйте хоть что-нибудь. Если посредством базы данных, то был бы много благодарен, если бы обрисовали это в двух словах. Заранее спасибо.
Ответить с цитированием