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.

  • 相关阅读:
    笔记
    作用域及this指向案例总结
    笔记
    JS 事件(捕获和冒泡 兼容性写法)
    tab标签
    笔记
    JS入门(10.16)
    JS入门(10.15)
    关键渲染路径
    Practice1小学四则运算(改进)
  • 原文地址:https://www.cnblogs.com/beeone/p/1800411.html
Copyright © 2011-2022 走看看