搜索
查看: 3020|回复: 16
打印 上一主题 下一主题

c语言怎么写显示系统时间

[复制链接]
楼主
发表于 2014-8-2 10:24:55 | 显示全部楼层
我发一个:[mw_shl_code=c,true]#include <time.h>
int main()
{
while(1>0)
{
struct tm*m;
    time_t secs;
    time(&secs);
    time_t now;
    time(&now);
    m=localtime(&secs);
printf("现在时间^-^:\n");
                        printf("[\n");
                        printf("   中文版^-^:\n");
                        printf("      %d年%d月%d日 ",m->tm_year+1900,m->tm_mon+1,m->tm_mday);
                                                printf("%d时%d分%d秒\n",m->tm_hour,m->tm_min,m->tm_sec);
                        printf("   英文版^-^:\n");
                        printf("      %s\n",ctime(&now));
                        printf("]\n");
                        system("cls");
}
system("pause");
return 0;
}
[/mw_shl_code]
沙发
发表于 2014-8-2 10:25:01 | 显示全部楼层
我发一个:[mw_shl_code=c,true]#include <time.h>
int main()
{
while(1>0)
{
struct tm*m;
    time_t secs;
    time(&secs);
    time_t now;
    time(&now);
    m=localtime(&secs);
printf("现在时间^-^:\n");
                        printf("[\n");
                        printf("   中文版^-^:\n");
                        printf("      %d年%d月%d日 ",m->tm_year+1900,m->tm_mon+1,m->tm_mday);
                                                printf("%d时%d分%d秒\n",m->tm_hour,m->tm_min,m->tm_sec);
                        printf("   英文版^-^:\n");
                        printf("      %s\n",ctime(&now));
                        printf("]\n");
                        system("cls");
}
system("pause");
return 0;
}
[/mw_shl_code]
板凳
发表于 2014-8-2 10:25:35 | 显示全部楼层
不小心发了两遍,呵呵
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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