zoukankan      html  css  js  c++  java
  • 显示百分比

     
    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;

    type
      TForm1 = class(TForm)
        Edit1: TEdit;
        Edit2: TEdit;
        Edit3: TEdit;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}
    var min,Max,value:Extended;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        min:=StrToInt(Edit1.text);
        max:=strtoint(Edit2.text);//被除数不能为0
        if Max=0 then Exit;
        value:= (min / max)*100;
        Edit3.text:=Format('%f',[value])+'%';
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
     Edit1.text:='0';
     Edit2.text:='1';
     Edit3.text:='0%';
     Edit3.Enabled:=false;
    end;

    end.




    附件列表

    • 相关阅读:
      SSM框架整合以及书籍管理CRUD系统
      FastJson将Java对象转换成json
      2016 USP Try-outs The Knapsack problem
      HDU6624
      杂题
      AtCoder Grand Contest 049 Increment Decrement
      Codeforces Round #684 (Div. 1)
      World Finals 2014 I
      bzoj1892
      CF1307G
    • 原文地址:https://www.cnblogs.com/xe2011/p/2527318.html
    Copyright © 2011-2022 走看看