| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1427 人关注过本帖
标题:c-free里出的毛病
只看楼主 加入收藏
jxk821015
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2006-8-22
收藏
 问题点数:0 回复次数:2 
c-free里出的毛病

下面这个程序编译不过去,我用的c-free。tc能,为什么c-free4.0不能呢!
**********************************************************************************************

#include "stdio.h" /*I/O函数*/
#include "stdlib.h" /*其它说明*/
#include "string.h" /*字符串函数*/
#include "conio.h" /*屏幕操作函数*/
#include "mem.h" /*内存操作函数*/
#include "ctype.h" /*字符操作函数*/
#include "alloc.h" /*动态地址分配函数*/
struct score
{
int mingci;
char xuehao[8];
char mingzi[20];
float score1[6];
}data,info[1000];
int i,j,k=0;
char temp[20],ch;
FILE *fp,*fp1;

void shuru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i<=1000;i++)
{
printf("\nPlease shuru xuehao:");
gets(data.xuehao);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score1[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score1[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score1[2]=atof(temp);
printf("Please shuru wuli score:");
gets(temp);data.score1[3]=atof(temp);
printf("Please shur huaxue score:");
gets(temp);data.score1[4]=atof(temp);
data.score1[5]=data.score1[0]+data.score1[1]+data.score1[2]+data.score1[3]+data.score1[4];
fwrite(&data,sizeof(data),1,fp);
printf("another?y/n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} fclose(fp);
}
void xianshi()
{
float s;int n;
if((fp=fopen("s_score.txt","rb+"))==NULL)
{
printf("Cannot reading this file.\n");
exit(0);
}
for(i=0;i<=1000;i++)
{
if((fread(&info[i],sizeof(info[i]),1,fp))!=1)
break;
}
printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");
for(j=0,k=1;j<i;j++,k++)
{
info[j].mingci=k;
printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score1[0],info[j].score1[1],info[j].score1[2],info[j].score1[3],info[j].score1[4],
info[j].score1[5]);
}
getch();
fclose(fp);
}

void xiugai()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xiugai xuehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score1[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score1[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score1[2]=atof(temp);
printf("Please input wuli score:");
gets(temp);data.score1[3]=atof(temp);
printf("Please input huaxue score:");
gets(temp);data.score1[4]=atof(temp);
data.score1[5]=data.score1[0]+data.score1[1]+data.score1[2]+data.score1[3]+data.score1[4];

} fwrite(&data,sizeof(data),1,fp1);
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(&data,sizeof(data),1,fp1))==1)
{
fwrite(&data,sizeof(data),1,fp);
}

fclose(fp);
fclose(fp1);
}
void chazhao()
{
if((fp=fopen("s_score.txt","rb"))==NULL)
{
printf("\nCannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xuehao chakan:");
scanf("%d",&i);
while(fread(&data,sizeof(data),1,fp)==1)
{
j=atoi(data.xuehao);
if(i==j)
{
printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score1[0],data.score1[1],data.score1[2],data.score1[3],data.score1[4],data.score1[5]);
}getch();
}
}
void shanchu()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("\nopen score.txt was failed!");
getch();
exit(0);
}
printf("\nPlease input ID which you want to del:");
scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{

printf("Anykey will delet it.\n");
getch();
continue;
}
fwrite(&data,sizeof(data),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n");
printf("Anykey will return to main.");
getch();
}
main()
{
while(1)
{
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移动光标*/
textcolor(YELLOW); /*设置文本显示颜色为黄色*/
textbackground(BLUE); /*设置背景颜色为蓝色*/
window(1,1,99,99); /* 制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr();
printf("*************welcome to use student manage******************\n");
printf("*************************menu********************************\n");
printf("* ========================================================= * \n");
printf("* 1>shuru 2>xiugai * \n");
printf("* 3>shanchu 4>chazhao * \n");
printf("* 5>xianshi 6>exit * \n");
printf("* * \n");
printf("* --------------------------------------------------------- * \n");
printf(" Please input which you want(1-6):");
ch=getch();
switch(ch)
{
case '1':shuru();break;
case '2':xiugai(); break;
case '3':shanchu(); break;
case '4':chazhao(); break;
case '5':xianshi(); break;
case '6':exit(0);
default: continue;
}
}
}

*******************************************************************************
--------------------配置: mingw2.95 - CUI Debug, 编译器类型: MinGW (Old)--------------------

检查文件依赖性...
正在编译 C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C...
正在连接...
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:168: undefined reference to `clrscr'
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:169: undefined reference to `gotoxy'
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:170: undefined reference to `textcolor'
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:171: undefined reference to `textbackground'
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:172: undefined reference to `window'
[Error] C:\Documents and Settings\jxk\桌面\学生成绩管理系统1.C:173: undefined reference to `clrscr'

构建中止 学生成绩管理系统1: 6 个错误, 0 个警告
就是上面的问题

搜索更多相关主题的帖子: include 内存 函数 毛病 
2006-09-02 09:55
soft_wind
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:1430
专家分:0
注 册:2006-4-5
收藏
得分:0 
c-free不支持屏幕和图形函数。
在TC下运行就OK了.

对不礼貌的女生收钱......
2006-09-02 10:00
jxk821015
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2006-8-22
收藏
得分:0 
谢谢了,版主大哥

2006-09-02 10:02
快速回复:c-free里出的毛病
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.088835 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved