编写函数计算一学期天数,结构体不如何懂,求指教
编写函数计算一学期天数,结构体不怎么懂,求指教
计算2011~2012下学期,从2012.2.12到2012.7.3有多少天,,,
用结构体:
struct Date
{
int day,month,year,days;
char monthname[4];
}
结构体确实不怎么懂,这么多参数,都该怎么用?怎么写?
------解决方案--------------------
先去弄懂了再写呗
------解决方案--------------------
计算天数和结构体有神马关系?
------解决方案--------------------
计算2011~2012下学期,从2012.2.12到2012.7.3有多少天,,,
用结构体:
struct Date
{
int day,month,year,days;
char monthname[4];
}
结构体确实不怎么懂,这么多参数,都该怎么用?怎么写?
------解决方案--------------------
先去弄懂了再写呗
------解决方案--------------------
计算天数和结构体有神马关系?
------解决方案--------------------
- C/C++ code
time_t mktime(struct tm *tm); struct tm { int tm_sec; /* seconds */ int tm_min; /* minutes */ int tm_hour; /* hours */ int tm_mday; /* day of the month */ int tm_mon; /* month */ int tm_year; /* year */ int tm_wday; /* day of the week */ int tm_yday; /* day in the year */ int tm_isdst; /* daylight saving time */ };
------解决方案--------------------
struct Date
{
int day,month,year,days;
char monthname[4];
}shiyongfafang;
也就是还要创建结构体变量引用花括号里面的结构体成员