博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
根据金额计算总张数最少的方案
阅读量:4948 次
发布时间:2019-06-11

本文共 1844 字,大约阅读时间需要 6 分钟。

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。

转载于:https://www.cnblogs.com/endsnow/archive/2011/12/03/2274769.html

你可能感兴趣的文章
Codeforces 40 E. Number Table
查看>>
CLR via C#(第3 版)
查看>>
java语法之final
查看>>
关于响应式布局
查看>>
详解ASP.Net 4中的aspnet_regsql.exe
查看>>
python 多进程和多线程的区别
查看>>
hdu1398
查看>>
[android] 网络断开的监听
查看>>
156.Binary Tree Upside Down
查看>>
MongoDB在windows下安装配置
查看>>
Upselling promotion stored procedure
查看>>
mysql编码配置
查看>>
KVM地址翻译流程及EPT页表的建立过程
查看>>
sigar
查看>>
iOS7自定义statusbar和navigationbar的若干问题
查看>>
c++ 网络编程(一)TCP/UDP windows/linux 下入门级socket通信 客户端与服务端交互代码...
查看>>
程序员如何提高影响力:手把手教你塑造个人品牌
查看>>
身份证校验原理和PHP实现
查看>>
[Locked] Wiggle Sort
查看>>
deque
查看>>