搜索
查看: 1102|回复: 3
打印 上一主题 下一主题

[原创] 小日历

[复制链接]
跳转到指定楼层
楼主
发表于 2014-5-15 09:45:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
看吧·~~~~~~~~~~~~~

日历.rar

9.04 KB, 下载次数: 108

沙发
发表于 2014-5-15 19:39:16 | 只看该作者
本帖最后由 1935515130 于 2014-5-15 19:41 编辑

太赞了!!!
板凳
 楼主| 发表于 2014-5-16 09:00:11 | 只看该作者

呵呵         
地板
发表于 2015-2-12 07:28:13 | 只看该作者
改编了下,请笑纳。
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <conio.h>
int main()
{
        system("title 哈哈哈,这里是C语言的CMD窗!!");
        system("pause");
    system("cls");
        system("echo 哈哈哈,欢迎来到C语言编程的CMD窗口。");
        system("pause");
    system("cls");
    printf("下面,系统将会输出当前时间:\n");
    system("pause");
    system("cls");
    struct tm*m;
    time_t secs;
    time(&secs);
    time_t now;
    time(&now);
    m=localtime(&secs);
    char str[10];
    if(!(strncmp(ctime(&now),"Sun",3)))
                strcpy(str,"日");
    if(!(strncmp(ctime(&now),"Mon",3)))
                strcpy(str,"一");
    if(!(strncmp(ctime(&now),"Tue",3)))
                strcpy(str,"二");
    if(!(strncmp(ctime(&now),"Wed",3)))
                strcpy(str,"三");
    if(!(strncmp(ctime(&now),"Thu",3)))
                strcpy(str,"四");
    if(!(strncmp(ctime(&now),"Fri",3)))
                strcpy(str,"五");
    if(!(strncmp(ctime(&now),"Sat",3)))
                strcpy(str,"六");
    system("mode con: cols=43 lines=1");
    HWND handle=GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO cursor_info={1,0};
    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
    HWND hWnd=GetForegroundWindow();
    system("color 1b");
    while(1)
    {
                time(&secs);
                m=localtime(&secs);
                printf("现在时间: ");
        printf("%d年%d月%d日 星期%s ",m->tm_year+1900,m->tm_mon+1,m->tm_mday,str);
                printf("%d时%d分%d秒",m->tm_hour,m->tm_min,m->tm_sec);
        if(kbhit())
                        exit(0);
        Sleep(1000);
        system("cls");
    }
        return 0;
}[/mw_shl_code]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表