| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 322 人关注过本帖
标题:这个有什么问题啊?
只看楼主 加入收藏
青橄榄
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-10-4
收藏
 问题点数:0 回复次数:0 
这个有什么问题啊?
/*************** 导入 ****************/
int Load(PlaneLink *Q,TrustLink *T)
{
int Lflag;
PlaneLink *q;
TrustLink *t;
FILE *fp;

T->next=NULL;
Q->next=NULL;
printf("请选择导入资料(1.航班资料 2.机票资料):");
scanf("%d",&Lflag);
while(Lflag!=0&&Lflag!=1&&Lflag!=2)
{

getchar();
printf("输入错误!\n");
printf("是否继续输入:(1/0)");
scanf("%d",&Lflag);
}
switch(Lflag)
{
case 1:
if((fp=fopen("D:/航班资料.txt","r+"))==NULL)
{
printf("导入失败!\n");
return NULL;
}
printf("成功导入资料:\n");
fscanf(fp,"\t\t\t\t\t航班资料\t\t\t\t\n");
fscanf(fp,"---------------------------------------------------------------------------------------------------------\n");
fscanf(fp,"\t\t|航班编号|始发站 |终点站 |机票价格|机票数 |起飞时间|乘客数 |\n");
//printf("\t\t\t航班资料\t\t\t\n");
//printf("----------------------------------------------------------------------------\n");
//printf("|航班编号|始发站 |终点站 |机票价格|机票数 |起飞时间|乘客数 |\n");
do
{
q=(PlaneLink*)malloc(sizeof(PlaneLink));
fscanf(fp,"%s\n|%8s|%8s|%8s|%7.1f|%8d|%8s|%8d|\n",q->number,q->start,q->end,&q->Piece,&q->tick,q->temps,&q->passege);
//printf("|%8s|%8s|%8s|%7.1f|%8d|%8s|%8d|\n",q->number,q->start,q->end,q->Piece,q->tick,q->temps,q->passege);
printf("%s\n",q->number);
q->next=Q->next;
Q->next=q;
}while(!feof(fp));
fclose(fp);
PrintPlane(q);
return Q;

case 2:
if((fp=fopen("D:/机票资料.txt","r+"))==NULL)
{
printf("导入失败!\n");
return NULL;
}
printf("成功导入资料:\n");
fscanf(fp,"\t\t\t\t\t机票资料\t\t\t\t\n");
fscanf(fp,"---------------------------------------------------------------------------------------------------------\n");
fscanf(fp,"\t\t|客户姓名|性别|有效证件|航班编号|始发站|终点站|机票数量|\n");
//printf("\t\t\t\t\t机票资料\t\t\t\t\n");
//printf("---------------------------------------------------------------------------------------------------------\n");
//printf("\t\t|客户姓名|性别|有效证件|航班编号|始发站|终点站|机票数量|\n");
do
{
t=(TrustLink*)malloc(sizeof(TrustLink));
fscanf(fp,"|%8s|%4s|%8d|%8s|%6s|%6s|%8d|\n",t->TrustName,t->TrustSex,t->TrustNumber,t->TrustPlane,t->TrustStart,t->TrustEnd,t->TrustTick);
printf(fp,"|%8s|%4s|%8d|%8s|%6s|%6s|%8d|\n",t->TrustName,t->TrustSex,t->TrustNumber,t->TrustPlane,t->TrustStart,t->TrustEnd,t->TrustTick);
t->next=T->next;
T->next=t;
}while(!feof(fp));
fclose(fp);
return T;

case 0:
return NULL;
}
}
2007-10-05 20:31
快速回复:这个有什么问题啊?
数据加载中...
 
   



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

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