
18.11.2014, 23:30
|
 |
LMD-DML
|
|
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
|
|
Цитата:
Сообщение от delpi12
...чтобы ввыведились толка самые повторяющие
|
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
i, b, c: integer;
s: string;
ia: array of integer;
begin
with StringGrid1 do
begin
for i := 0 to rowCount-1 do (Objects[0, i] as TBoolObj).flg:= false;
SetLength(ia,rowCount);
for i := 0 to rowCount-1 do
begin
s:= Cells[0, i];
for b := 0 to rowCount-1 do if Cells[0, b] = s then Inc(ia[i]);
end;
b:= 0;
for i := 0 to rowCount-1 do if ia[i]> b then
begin
b:= ia[i];
c:= i;
end;
for i := 0 to rowCount - 1 do
if Cells[0,i] = Cells[0,c] then (Objects[0, i] as TBoolObj).flg:= true;
Repaint;
end; {with}
end;
совсем без оптимизации
|