- 1
- 2
- 3
- 4
TblCashBook.First();
while not TblCashBook.Eof do begin
if not (TblCashBook.FieldByName('Date').AsDateTime <=
ReportDate) then Continue;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+103.8
TblCashBook.First();
while not TblCashBook.Eof do begin
if not (TblCashBook.FieldByName('Date').AsDateTime <=
ReportDate) then Continue;
+102.5
procedure TFrmCashBook.ButtonGroupDeleteClick(Sender: TObject);
var
CmpField : String;
CmpOperator : String;
StringToCmp : String;
DeletedCount : Integer;
begin
if MessageDLG('Âû óâåðåíû?', mtConfirmation,
[mbYes,mbNo],0) <> mrYes then Exit;
CmpField := GroupDeleteSelectFieldComboBox.Text;
CmpOperator := GroupDeleteSelectComparisonOperatorComboBox.Text;
// âîçìîæíûå îïåðàòîðû '=', '>', '>=', '<', '<='
StringToCmp := GroupDeleteEdit.Text;
DeletedCount := 0;
with DM.TblCashBook do begin
First();
while not EOF do begin
if ( (CmpOperator = '=' ) and
(FieldByName(CmpField).AsString = StringToCmp ) ) or
( (CmpOperator = '>' ) and
(FieldByName(CmpField).AsString > StringToCmp) ) or
( (CmpOperator = '>=') and
(FieldByName(CmpField).AsString >= StringToCmp) ) or
( (CmpOperator = '<' ) and
(FieldByName(CmpField).AsString < StringToCmp) ) or
( (CmpOperator = '<=') and
(FieldByName(CmpField).AsString <= StringToCmp) ) then
begin
Delete();
DeletedCount := DeletedCount + 1;
end
else //åñëè çàïèñü óäàëåíà, next() íå íóæåí
Next();
end;
end; //with
ShowMessage('Óäàëåíî çàïèñåé: ' + inttostr(DeletedCount));
end;
+144.9
function ... : Integer;
var
i:integer;
begin
Result := 0;
for i := 1 to ... do
if bla-bla then
inc(Result);
Result := Result;
end;
+102
begin
tru:=false;
if tru=false then
begin
ObrMatritsa(Sigm,Sigm_transp);
tru:=true;
det:=abs(Determinant(Sigm));
if det=0 then
begin
ShowMessage('Determinant = 0');
tru:=false;
Application.Terminate;
exit;
end;
//if det=0 then begin result:=0 ; exit end;
sum:=1/sqrt(power(2*pi,kol_prizn)*det* exp(Mas));
if sum=0 then result:=0 ;
end else exit;
end;
+92
{$R-}
fal:=true;
ty:= length(mas1);
while(fal=true) do
for j:=0 to kp-1 do
begin
for i:=i+k+j to length(mas2)-1 do
begin
while mas2[i+k]= ty do
begin
s:=s+c[i,j];
inc(k);
end;
end;
nl:=mas1[ty-1];
if nl=0 then
mas_Mj[ty]:=0
else
mas_Mj[ty-1][j]:=s/nl;
s:=0;
end;
+106.6
if WordCount>GetWord(i) then else if WordCount>GetWord(i) then
begin
// ...
// ...
end;
при каких условиях выполнится код между begin-end?..
+86.6
if Mode = True then
из исходников FastReport
−96
{//}l:= a+sqrt(b);
{//}r:= c+sqrt(d);
Ещё из одного исходника олимпиадной задачи. Не удалять же символы комментов, если их можно закомментить?
+95.3
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,
IdCookieManager, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, ExtCtrls, ComCtrls, Grids, ValEdit,IniFiles;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Button1: TButton;
IdHTTP1: TIdHTTP;
IdCookieManager1: TIdCookieManager;
ListView1: TListView;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Button2: TButton;
GroupBox2: TGroupBox;
Button3: TButton;
Edit3: TEdit;
Edit4: TEdit;
TabSheet3: TTabSheet;
Memo1: TMemo;
Memo2: TMemo;
Button4: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Button5: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure TabSheet2Show(Sender: TObject);
procedure Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyThread = class
private
FHandle: THandle;
FID: Cardinal;
function Execute: DWord; stdcall;
public
constructor Create;
destructor Destroy; override;
end;
var
Form1: TForm1;
edit_nom:integer;
acc_list:tstringlist;
thread_count:integer;
implementation
{$R *.dfm}
function findinhtml(text:string;first:string;dop1:string;dop2:string;dop3:string;dop4:string;dop5:string;dop6:string;first_end:string;last:string):string;
var
a,b,c:string;
begin
a:=copy(text,pos(first,text)+length(first)+1,1000);
if dop1<>'' then a:=copy(a,pos(dop1,a)+length(dop1),length(a));
+102.3
for i:=1 to 3 do
if (f[i,1]<>a) and (f[i,2]<>b) then
begin
inc(n);
if n>3 then exit;
f[n,1]:=a;
f[n,2]:=b;
break;
end
else break;
О как!