?? unit1.pas
字號:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
//PROGRAM D2R5
//Driver for routine LOCATE
uses
unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
XX:array[0..100] of real;
X:real;
F:TextFile; I,J:Integer;
const
N=100; s1='%14.6f'; s3='#0';
begin
//Create array to be searched
For I:=1 to N do
XX[I]:= EXP(I/20)-74;
//輸出計算結果到文件
AssignFile(F, 'd:\delphi_shu\p2\d2r5.dat');
Rewrite(F);
Writeln(F, 'Result of: j=0 indicates x too small');
Writeln(F, ' j=100 indicates x too large');
Writeln(F, ' locate j xx(j) xx(j+1)');
//For test
For I:= 1 To 19 do
begin
X:=-100 + 200 * I / 20;
LOCATE(XX, N, X, J);
If J = 0 Then
Writeln(F,Format(s1,[X]),' ',FormatFloat(s3,J),' ',
'lower lim',Format(s1,[XX[J+1]]))
Else If J = N Then
Writeln(F,Format(s1,[X]),' ',FormatFloat(s3,J),' ',
Format(s1,[XX[J]]),' upper lim ')
Else if (J<>0) and (J<>N) Then
Writeln(F,Format(s1,[X]),' ',FormatFloat(s3,J),' ',
Format(s1,[XX[J]]),Format(s1,[XX[J+1]]));
end;
CloseFile(F);
//屏幕顯示計算結果
memo1.ScrollBars:=ssVertical;
memo1.Lines.LoadFromFile('d:\delphi_shu\p2\d2r5.dat');
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -