unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Edit5: TEdit; Edit6: TEdit; Edit7: TEdit; Edit8: TEdit; Edit9: TEdit; Edit10: TEdit; Edit11: TEdit; Button1: TButton; Edit12: TEdit; Label12: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;function Divisible (var i: double; k: integer; var c: integer): integer;implementation{$R *.dfm}function Divisible (var i: double; k: integer; var c: integer): integer;begin Divisible := Trunc(i/k); c := c + Trunc(i/k); i := i - Trunc(i/k)*k;end;procedure TForm1.Button1Click(Sender: TObject);var s: double; count: integer;begin count := 0; s := strtofloat(Edit1.Text); Edit2.Text := inttostr(Divisible(s,100,count))+'张'; Edit3.Text := inttostr(Divisible(s,50,count))+'张'; Edit4.Text := inttostr(Divisible(s,20,count))+'张'; Edit5.Text := inttostr(Divisible(s,10,count))+'张'; Edit6.Text := inttostr(Divisible(s,5,count))+'张'; Edit7.Text := inttostr(Divisible(s,2,count))+'张'; Edit8.Text := inttostr(Divisible(s,1,count))+'张'; s := Round(s * 10); Edit9.Text := inttostr(Divisible(s,5,count))+'张'; Edit10.Text := inttostr(Divisible(s,2,count))+'张'; Edit11.Text := inttostr(Divisible(s,1,count))+'张'; Edit12.Text := inttostr(count)+'张'; edit1.SelectAll; edit1.SetFocus;end;end.
Edit的Alignment属性设置为taRightJustify。