struct Type/*构造全局结构类型*/
{
char fnum[9];
char fcompony[8];
char fstart[8];
}; //里面声明的都是单字符,后面初始化的都是字符串
struct Type line[2]={{"zx123","ejfig","11:00"},
{"dh123","shdhdu","12:00"}
};
void deleteFlight()
{
char fnum3[8];
int i;
printf("请输入您要删除的航班号:\n");
scanf("%s",fnum3);/*管理员输入想删除的航班号*/
FILE *fp;
fp=fopen("finformation.txt","a+");
for(i=0;i<2;i++)
{
if(strcmp(line[i].fnum,fnum3)==0) {
line[i]=line[i+1];
printf("成功删除!");
break;
}
}
if(i==2)
printf("没有该航班号!");
}
没有完整代码,随手改的。