⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 《Delphi常用数值算法集》的配书源码
💻 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 D5R3
//Driver for routine POLDIV
uses
  unit2;
  {$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
  F:TextFile;
  U,V,Q,R:array[0..6] of real;
const
  s1='%8.2f'; N = 6; NV = 4; 
begin
  U[1]:=-1;    U[2]:=5;
  U[3]:=-10;   U[4]:=10;
  U[5]:=-5;    U[6]:=1;
  V[1]:=1;     V[2]:=3;
  V[3]:=3;     V[4]:=1;
  //输出计算结果到文件
  AssignFile(F, 'd:\delphi_shu\p5\d5r3.dat');
  Rewrite(F);
  POLDIV(U,N,V,NV,Q,R);
  Writeln(F, '    X^0     X^1     X^2     X^3     X^4     X^5 ');
  Writeln(F, 'Quotient polynomial coeffcients:');
  Writeln(F,Format(s1,[Q[1]]),Format(s1,[Q[2]]),Format(s1,[Q[3]]),
            Format(s1,[Q[4]]),Format(s1,[Q[5]]),Format(s1,[Q[6]]));
  Writeln(F, 'Expected quotient coeffcients:');
  Writeln(F, '   31.00,  -8.00,   1.00,   0.00,   0.00,   0.00');
  Writeln(F, 'Remainder polynomial coefficients:');
  Writeln(F,Format(s1,[R[1]]),Format(s1,[R[2]]),Format(s1,[R[3]]),
            Format(s1,[R[4]]));
  Writeln(F, 'Expected quotient coeffcients:');
  Writeln(F, '  -32.00,  -80.00,  -80.00,  0.00');
  CloseFile(F);
  //屏幕显示计算结果
  memo1.Lines.LoadFromFile('d:\delphi_shu\p5\d5r3.dat');
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -