📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ccalendr"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
LeapYear = 0;
}
//---------------------------------------------------------------------------
static int CountOfLeapYear(int year)
{
int countyear1 = year%400;
int countyear2 = countyear1%100;
int countyear3 = countyear2%4;
int count1 = year/400;
int count2 = countyear1/100;
int count3 = countyear2/4;
int totalcount = count1*97 + count2*24 + count3;
return totalcount;
}
//---------------------------------------------------------------------------
static int CountOfMonth(int month)
{
int MonthInaYear[]={31,28,31,30,31,30,31,31,30,31,30,31};
int result = 0;
for(int i=0;i<month;++i)
{
result += MonthInaYear[i];
}
return result;
}
//---------------------------------------------------------------------------
static int CountDaysFrom(int year,int month,int day)
{
int leapYear = CountOfLeapYear(year-1);
int md = CountOfMonth(month-1);
if(IsLeapYear(year) && month>2)
{
++md;
}
return ((year-1)*365 + leapYear + md + day);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnCloseClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void TForm1::Determine()
{
String Week[] = {"ら","8","
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -