有关vc 的问题

来源:百度知道 编辑:UC知道 时间:2024/06/11 08:58:48
CTime time=CTime::GetCurrentTime();

if(time.GetYear()>2003)
{ 显示出错信息并退出;
if(time.GetMonth()>6)
显示出错信息并退出;
if(time.GetDay()>7)
显示出错信息并退出;
}
要实现的功能是到2003年6月23日之后要求你注册即日期超期
以上程序有错误,请帮忙找出错误

// ctime.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

#include <afx.h>
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
CTime time=CTime::GetCurrentTime();
if(time.GetYear()>2003)
{
cout<<"使用超时"<<endl;
}
if((time.GetMonth()>6)&&(time.GetYear()==2003))
{
cout<<"使用超时"<<endl;
}
if((time.GetDay()>7)&&(time.GetMonth()==6)&&(time.GetYear()==2003))
{
cout<<"使用超时"<<endl;
}

}

CTime time=CTime::GetCurrentTime();
CTime time2(2003,6,7);
CTimeSpan timespan=time-time2;
if (timespan.GetSecond()>0)
{
注册即日期超期,显示出错并退出。
}