刘华世的官方博客

VC++语言如何输出当前日期,如何获取当前日期

//writeby: lhsbqb
//date:2012-10-17
//title:VC++语言如何输出当前日期,如何获取当前日期
#include "time.h"
#include "iostream.h"
#include "windows.h"

int main(int argc, char* argv[])
{
    time_t nowTime;


    while(true)
    {
    time(&nowTime);
    struct tm *sysTime = localtime(&nowTime);
    system("title 蟒蛇软件站 http://www.pythonschool.com");
    system("mode con cols=55 lines=2");
    system("cls");

    cout << "系统日期:" << 1900 + sysTime->tm_year << ""
         << sysTime->tm_mon+1 << "" << sysTime->tm_mday << "" 
         <<sysTime->tm_hour << "" << sysTime->tm_min << "" 
         << sysTime->tm_sec << "" << endl;    

    
    Sleep(1000);
    }

    
    //time_t timer = time(NULL);
    //cout << ctime(&timer) << endl;
    return 0;
}

http://pythonschool.com/python/2.html 转摘

posted @ 2012-10-18 09:41  pythonschool  阅读(406)  评论(0编辑  收藏  举报
刘华世的官方博客