我想比较时间大小,但怎么结果不对?帮我看看我错在那了
bool CMDlg::ChkTime()
{
tm1=CTime::GetCurrentTime();
if (tm1<=(tm1.GetYear,tm1.GetMonth,tm1.GetDay,8,30,0))
return false;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,8,30,0)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,12,0,0))
return true;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,12,0,0)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,2,30,0))
return false;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,2,30,00)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,17,30,0))
return true;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,17,30,0))
return false;
}
bool CMDlg::ChkTime()
{
tm1=CTime::GetCurrentTime();
if (tm1<=(tm1.GetYear,tm1.GetMonth,tm1.GetDay,8,30,0))
return false;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,8,30,0)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,12,0,0))
return true;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,12,0,0)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,2,30,0))
return false;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,2,30,00)
&& tm1<(tm1.GetYear,tm1.GetMonth,tm1.GetDay,17,30,0))
return true;
if (tm1>(tm1.GetYear,tm1.GetMonth,tm1.GetDay,17,30,0))
return false;
}
if (tm1>=(tm1.GetYear(),tm1.GetMonth(),tm1.GetDay(),8,30,0))
return false;
if (tm1>= CTime(tm1.GetYear(),tm1.GetMonth(),tm1.GetDay(),8,30,0))
return false;
if (tm1<(tm1.GetYear(),tm1.GetMonth(),tm1.GetDay(),12,30,0))
return true ;
else
return false ;为虾米这个返回false 呢?我觉得好像不是 成员函数调用全都没有加括号 这个问题巴
CTime t1 = CTime::GetCurrentTime();
CTime t2 = t1 + CTimeSpan( 0, 3, 0, 0 ); // 3 hour later
if ( t1 < t2 )
return true;
else
return false;
其实就是tml没有定义类型,成员函数少了括号造成的。
tml的定义也可能在.h中你怎么着么肯定他没有定义类型呢?成员函数少了括号造成的这个我同意你的观点。
里面重载了〉,<等