Forum www.til2010.fora.pl Strona Główna
 FAQ   Szukaj   Użytkownicy   Grupy    Galerie   Rejestracja   Profil   Zaloguj się, by sprawdzić wiadomości   Zaloguj 

radioGroup

 
Napisz nowy temat   Odpowiedz do tematu    Forum www.til2010.fora.pl Strona Główna -> II rok 2011/2012 / Semestr III / INFORMATYKA
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Asia




Dołączył: 14 Paź 2010
Posty: 92
Przeczytał: 0 tematów

Skąd: Grudziądz

PostWysłany: Pon 18:41, 14 Lis 2011    Temat postu: radioGroup

unit U1710;

interface

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

type
TForm7 = class(TForm)
StringGrid1: TStringGrid;
Edit1: TEdit;
Button1: TButton;
Panel1: TPanel;
Button2: TButton;
Button3: TButton;
RadioGroup1: TRadioGroup;
procedure FormCreate(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form7: TForm7;

implementation

{$R *.dfm}

procedure TForm7.FormCreate(Sender: TObject);
var i,j:integer;
begin
randomize;
for i := 0 to stringgrid1.ColCount-1 do
for j := 0 to stringgrid1.RowCount-1 do
stringgrid1.cells[i,j]:=inttostr(random(101));
end;


procedure TForm7.RadioGroup1Click(Sender: TObject);
var wiersz,kolumna:integer;
var nw,nk,max1,x,k,w:smallint;
begin
randomize;
wiersz:=random(stringgrid1.RowCount);
kolumna:=random(stringgrid1.ColCount);
case radiogroup1.itemindex of
0:begin
max1:=strtoint(stringgrid1.Cells[0,wiersz]);
for kolumna := 1 to stringgrid1.colcount - 1 do
begin
x:=strtoint(stringgrid1.cells[kolumna,wiersz]);
if x>max1 then max1:=x;
end;
panel1.caption:='największy losowo wybrany element w wierszu' +inttostr(wiersz+1)+
'wynosi'+inttostr(max1);
end;
1: begin
max1:=strtoint(stringgrid1.cells[kolumna,0]);
for wiersz := 1 to stringgrid1.colCount - 1 do
begin
x:=strtoint(stringgrid1.cells[kolumna,wiersz]);
if x>max1 then max1:=x;
end;
panel1.caption:='największy losowo wybrany element w kolumnie ' +
inttostr(kolumna+1)+' wynosi '+inttostr(max1);
end;
2: begin
max1:=strtoint(stringgrid1.Cells[kolumna,wiersz]);
for kolumna := 1 to stringgrid1.colcount - 1 do
for wiersz := 1 to stringgrid1.rowCount - 1 do
begin
x:=strtoint(stringgrid1.cells[kolumna,wiersz]);
if x>max1 then
begin
k:=kolumna;
w:=wiersz;
max1:=x;
end;
end;
panel1.caption:='największy losowo wybrany element w tabeli o numerze wiersza '+inttostr(w+1) +
'i numerze kolumny ' + inttostr(k+1) +'wynosi' +inttostr(max1);
end;
end;
end;
end.
Powrót do góry
Zobacz profil autora
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum www.til2010.fora.pl Strona Główna -> II rok 2011/2012 / Semestr III / INFORMATYKA Wszystkie czasy w strefie CET (Europa)
Strona 1 z 1

 
Skocz do:  
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group

Theme xand created by spleen & Programosy.
Regulamin