本题目要求计算存款利息,计算公式为interest=money×(1+rate) \nyear\n −money,其中interest为存款到期时的利息(税前),money是存款金额,year是存期,ra
时间: 2023-04-27 09:02:56 浏览: 84
本题目要求计算存款利息,公式为interest=money×(1+rate)^year-money,其中interest为存款到期时的利息(税前),money是存款金额,year是存期,rate是利率。
相关问题
//#define ENTER 13 #define start_year 1840 #define end_year 2100 typedef enum {false = 0, true = 1} bool; typedef struct _LONGTIME{ int wYear; int wMonth; int wDayOfWeek; int wDay; int wHour; int wMinute; int wSecond; int wMillisecond; }LONGTIME,*PLONGTIME,LPLONGTIME;//时间结构体 typedef struct _LUNARDATE{ long int iYear; int wMonth; int wDay;//农历年、月、日 bool bIsLeap;//闰月标志 unsigned int iDaysofMonth;//大月天数 }LUNARDATE,*PLUNARDATE,LPLUNARDATE; int Yuexu[]={ //月序码表 /*******函 数 声 明*******/ void DateRefer(int year,int month,int day,bool SST); //公历查农历 int GetDaysOfMonth(int year,int month,bool mode,bool bLeap);//取当前月份天数,mode为false时,查公历,mode为true时查农历,此时bLeap为是否闰月 void ShowCalendar(int year,int month,int day); //打印一个月的月历 int Jizhun(int year,int month,int day); //算出基准天 int int2(double v); //取整 double GetDecimal(double n); //取得小数部分 LONGTIME GetDate(double n); //将小数日转公历 int GetGre(LUNARDATE LunarDate); //农历查公历 LONGTIME GetCurTime(); //取当前系统时间 LONGTIME SysTimeToLong(SYSTEMTIME SystemTime); //时间结构体转换 LONGTIME GMTConvert(LONGTIME OrigTime); //时区转换 bool IsLeapYear(int nYear); //闰年 void ShowSolarTerms(int year);//显示二十四节气 void Holiday(int month);
感谢提供完整的代码。你似乎没有给出问题或需求,我可以就这段代码进行解释和说明。这段代码主要实现了一个农历日历的功能,包括公历查农历、打印月历、计算节气等。其中,`DateRefer()`函数用于公历查农历,通过传入一个公历日期(年月日)和是否是闰月标志,返回对应的农历日期;`GetDaysOfMonth()`函数用于计算一个月的天数,可以用于公历和农历;`ShowCalendar()`函数用于打印一个月的月历,包括公历和农历;`GetGre()`函数用于农历查公历,通过传入一个农历日期,返回对应的公历日期;`ShowSolarTerms()`函数用于计算并显示二十四节气;`Holiday()`函数用于计算并显示一个月的节日。这些函数实现了农历日历的核心功能,可以帮助用户查询和显示农历日期、节气和节日等信息。
VariantTimeToSystemTime 实现源码
VariantTimeToSystemTime 函数是将 Variant 时间值转换为系统时间值的函数。以下是该函数的实现源码:
```c++
BOOL VariantTimeToSystemTime(DATE dt, LPSYSTEMTIME lpSystemTime)
{
if (lpSystemTime == NULL)
return FALSE;
// 日期的整数部分是自 1899 年 12 月 30 日以来的天数
double dTemp = dt + HALF_SECOND / SECONDS_PER_DAY;
// 这个数字表示了 1900 年 1 月 1 日的日期
// 也就是说,它是 dTemp 中减去 2 的结果
int nDays = (int)dTemp;
// 将时间部分转换为 SYSTEMTIME 结构
double dblSecsInDay = dTemp - (double)nDays;
int nSeconds = (int)(dblSecsInDay * SECONDS_PER_DAY);
lpSystemTime->wHour = nSeconds / SECONDS_PER_HOUR;
nSeconds -= lpSystemTime->wHour * SECONDS_PER_HOUR;
lpSystemTime->wMinute = nSeconds / SECONDS_PER_MINUTE;
nSeconds -= lpSystemTime->wMinute * SECONDS_PER_MINUTE;
lpSystemTime->wSecond = nSeconds;
lpSystemTime->wMilliseconds = (WORD)((dblSecsInDay - (double)nSeconds) * 1000.0);
// 将日期部分转换为 SYSTEMTIME 结构
// 闰年必须是 4 的倍数,但世纪闰年必须是 400 的倍数
int nLeapYears = (nDays - DAYS_FROM_BASELINE_TO_1900) / 1461;
int nYear = 1900 + nLeapYears * 4;
int nDaysInLeapYear = (nDays - DAYS_FROM_BASELINE_TO_1900) % 1461;
for (;;)
{
int nDaysInYear = DaysInYear(nYear);
if (nDaysInLeapYear < nDaysInYear)
break;
nYear++;
nDaysInLeapYear -= nDaysInYear;
}
lpSystemTime->wYear = (WORD)nYear;
lpSystemTime->wMonth = 1;
int nMonth;
for (nMonth = 1; nMonth <= 12; nMonth++)
{
int nDaysInMonth = DaysInMonth(nMonth, IsLeapYear(nYear));
if (nDaysInLeapYear < nDaysInMonth)
break;
nDaysInLeapYear -= nDaysInMonth;
lpSystemTime->wMonth++;
}
lpSystemTime->wDay = (WORD)(nDaysInLeapYear + 1);
lpSystemTime->wDayOfWeek = (WORD)((nDays + 1) % 7);
return TRUE;
}
```
这段代码中包含了一些常量和辅助函数,它们的定义如下:
```c++
#define DAYS_FROM_BASELINE_TO_1900 693593
#define SECONDS_PER_DAY 86400
#define SECONDS_PER_HOUR 3600
#define SECONDS_PER_MINUTE 60
#define HALF_SECOND (1.0 / (2.0 * SECONDS_PER_DAY))
inline BOOL IsLeapYear(int nYear)
{
return ((nYear & 3) == 0) && ((nYear % 100) != 0 || (nYear % 400) == 0);
}
inline int DaysInMonth(int nMonth, BOOL bLeapYear)
{
static int nDaysInMonth[] =
{
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
return (nMonth == 2 && bLeapYear) ? 29 : nDaysInMonth[nMonth - 1];
}
inline int DaysInYear(int nYear)
{
return IsLeapYear(nYear) ? 366 : 365;
}
```