鱼C论坛

 找回密码
 立即注册
查看: 3797|回复: 5

怎样在TC中创建一个C文件啊

[复制链接]
发表于 2013-9-16 17:06:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <dos.h>
#include <stdio.h>

void main()
{
   struct date d;
   struct time t;
   getdate(&d);
   gettime(&t);
   printf("the current day is: %d--%d--%d\n", d.da_year, d.da_mon, d.da_day);
   printf("the current time is:%d:%d:%d", t.ti_hour, t.ti_min, t.ti_sec);
   getch();
}
日期及时间.c
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(6) : error C2079: 'd' uses undefined struct 'date'
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(7) : error C2079: 't' uses undefined struct 'time'
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(8) : warning C4013: 'getdate' undefined; assuming extern returning int
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(9) : warning C4013: 'gettime' undefined; assuming extern returning int
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(10) : error C2224: left of '.da_year' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(10) : error C2224: left of '.da_mon' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(10) : error C2224: left of '.da_day' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(11) : error C2224: left of '.ti_hour' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(11) : error C2224: left of '.ti_min' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(11) : error C2224: left of '.ti_sec' must have struct/union type
D:\C语言\MSDev98\MyProjects\日期及时间\日期及时间.c(12) : warning C4013: 'getch' undefined; assuming extern returning int
执行 cl.exe 时出错.

日期及时间.obj - 1 error(s), 0 warning(s)


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2013-9-16 17:29:31 | 显示全部楼层
struct date d;
struct time t;
这两个结构在哪里定义呢?声明在哪里呢?出错原因:未经声明而直接使用。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-9-16 18:58:32 | 显示全部楼层

额。。应该怎么输入?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-9-16 22:20:07 | 显示全部楼层
#include <conin.h>
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-8-3 12:42:55 | 显示全部楼层
牛逼
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2018-8-3 12:44:19 | 显示全部楼层
我一个2018年的来考古C语言知识
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-2 08:27

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表