zoukankan      html  css  js  c++  java
  • 输入 年,月,显示当月的天数

    unit Unit1;

    interface

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

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

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    function GetDays(Year,Mouth: integer): integer;
    begin
      case Mouth of
        1,3,5,7,8,10,12 : Result := 31;
        4,6,9,11 : Result :=30;
        2:begin
            if isleapYear(Year) then
            begin
              Result :=29;
            end else
            begin
              Result :=28;
            end;
          end else
        Result := 0;
      end;
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit3.Text := IntToStr(GetDays(StrToInt(Edit1.text),StrToInt(Edit2.text)));
    end;

    end.

  • 相关阅读:
    2016.7.17
    2016.7.16
    2016.7.15
    2016.7.12
    2016.7.11
    2016.7.10
    coco2d-x中的坐标系问题
    cocos2d-x中的Tiled地图
    cocos2d-x中的Box2D物理引擎
    python文件处理及装饰器
  • 原文地址:https://www.cnblogs.com/beeone/p/1800411.html
Copyright © 2011-2022 走看看