码迷,mamicode.com
首页 > 编程语言 > 详细

C++动态时间显示

时间:2018-09-22 23:48:55      阅读:458      评论:0      收藏:0      [点我收藏+]

标签:include   src   end   分享图片   time   etl   second   cout   alt   

#include <iostream>
#include<stdlib.h>
#include<windows.h>
#include<string>
using namespace std;
int main()
{
    string week = " ";
    while (1)
    {
        SYSTEMTIME systemTime;
        GetLocalTime(&systemTime);
        cout << "当前时间是:" << systemTime.wYear << "" << systemTime.wMonth << "" << systemTime.wDay << "";
        cout << systemTime.wHour << "" << systemTime.wMinute << "" << systemTime.wSecond << "";
        switch (systemTime.wDayOfWeek)
        {
        case 0:
            week = "";
            break;
        case 1:
            week = "";
            break;
        case 2:
            week = "";
            break;
        case 3:
            week = "";
            break;
        case 4:
            week = "";
            break;
        case 5:
            week = "";
            break;
        case 6:
            week = "";
            break;
        }
        cout << "   星期";
        cout << week << endl;
        Sleep(1000);
        system("cls");
    }
    return 0;

}

 

技术分享图片

 

C++动态时间显示

标签:include   src   end   分享图片   time   etl   second   cout   alt   

原文地址:https://www.cnblogs.com/ruiy/p/9691579.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!