使用win32控制台应用程序也能调通的啊,按Alt+F7,在C/C++的Category中选Code Generation,然后Use run-time library选Multithreaded,然后我直接写的代码:
#include <afx.h>
#include <iostream.h>
#include <time.h>
#include <afxtempl.h>
void main()
{
CString MyString;
CTime t=CTime::GetCurrentTime();
cout < <t.GetYear() < <endl < <t.GetDayOfWeek()
< <endl < <t.GetTime() < <endl < <t.GetGmtTm()-> tm_year < <endl;
MyString=t.Format( "%A, %B %d, %Y ");
cout < <t.GetLocalTm()-> tm_year < <endl < <MyString;
}
也能运行的。
#include <afx.h>
#include <iostream.h>
#include <time.h>
#include <afxtempl.h>
void main()
{
CString MyString;
CTime t=CTime::GetCurrentTime();
cout < <t.GetYear() < <endl < <t.GetDayOfWeek()
< <endl < <t.GetTime() < <endl < <t.GetGmtTm()-> tm_year < <endl;
MyString=t.Format( "%A, %B %d, %Y ");
cout < <t.GetLocalTm()-> tm_year < <endl < <MyString;
}
也能运行的。
本文介绍了如何在Win32控制台应用程序中使用C/C++进行代码编写,并通过实例展示了如何实现日期和时间的获取与输出。
1447

被折叠的 条评论
为什么被折叠?



