搜索
查看: 726|回复: 6
打印 上一主题 下一主题

各位大神们,我哪儿错了?~

[复制链接]
跳转到指定楼层
楼主
发表于 2014-6-27 16:53:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
6啊哈币
本帖最后由 丶Maped 于 2014-6-27 22:46 编辑

[mw_shl_code=c,true]#include<stdio.h>
#include<dos.h>
#include<conio.h>
int main(void)
{
        
      
        struct date datep;
        int year;
        char day,month;
        
        struct time timep;
        unsigned  char hour,minute,second,hundredsecond;
        
        
        //获取系统日期
        getdate(&datep);
        
        //把系统日期分为年、月、日
        year=datep.da_year;
        day=datep.da_day;
        month=datep.da_mon;
        
        
        //获取系统时间
        gettime(&timep);
        
        //把系统时间分为时、分、秒、毫秒
        hour=timep.ti_hour;
        minute=timep.ti_min;
        second=timep.ti_sec;
        hundredsecond=timep.ti_hund;
        
        
        //日期时间输出
        printf("              %2d 年 %2d 月 %2d 日, %2d:%02d:%02d:%02d\n",
        year,month,day,hour,minute,second,hundredsecond);
        
        
        return 0;
}
[/mw_shl_code]

沙发
发表于 2014-6-27 22:04:34 | 只看该作者
本帖最后由 超神级 于 2014-6-27 22:05 编辑

为什么不这样写?
[mw_shl_code=c,true]#include<stdio.h>
#include<time.h>
int main(void)
{   
time_t time2;
struct tm * time3;
time ( &time2 );
time3 = localtime ( &time2 );
printf ( "当前日期: %s", asctime (time3) );
return 0;
}[/mw_shl_code]
还有你使用的什么编译器???
板凳
 楼主| 发表于 2014-6-27 22:42:32 | 只看该作者
超神级 发表于 2014-6-27 22:04
为什么不这样写?
[mw_shl_code=c,true]#include
#include

C-free 5.0
地板
 楼主| 发表于 2014-6-27 22:44:39 | 只看该作者
本帖最后由 丶Maped 于 2014-6-27 23:44 编辑
超神级 发表于 2014-6-27 22:04
为什么不这样写?
[mw_shl_code=c,true]#include
#include
我要拆出来自定义位置放
5#
发表于 2014-6-28 02:08:40 | 只看该作者
丶Maped 发表于 2014-6-27 22:44
我要拆出来自定义位置放
  1. #include<time.h>
  2. #include<stdio.h>
  3. int main()
  4. {
  5. struct tm *t;
  6. time_t time2;
  7. time(&time2);
  8. t=localtime(&time2);
  9. printf("%4d年%02d月%02d日 %02d:%02d:%02d\n",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);
  10. return 0;
  11. }
复制代码
就这样了。睡觉了
6#
发表于 2014-6-28 13:39:07 | 只看该作者
超神级 发表于 2014-6-28 02:08
就这样了。睡觉了

晚上不好好睡觉
7#
发表于 2014-6-28 20:53:08 | 只看该作者

和朋友打游戏。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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