进行单步调试时,总if(strcmp(finalcity,p->finalcity )==0)和 while(nubmer!=p1->nubmer
#include<stdio.h>#include<malloc.h>
#include <stdlib.h>
#include<string.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define OVERFLOW 0
#define NULL 0
typedef struct passagerNode{
char name[20] ;
long ID ;
int seatnum ;
int booknum;
struct passagerNode *next;
struct passagerNode *passager;
}passagerNode,*linklist1;
typedef struct flightNode{
char finalcity[20] ; //抵达城市
int nubmer; //航班编号
char flight_no[20]; //飞机号
int time; //时间
int total; //总座位数
int remain;
int price; //票价
int discount; //折扣
flightNode *next;
linklist1 next1; //已定单链表
passagerNode passager;
}flightNode,*linklist2;
void find(){//按抵达城市查寻航线信息
linklist2 L, p;
char finalcity[20];
p=L ;
printf("请输入要查寻的飞达的城市\n");
scanf("%s",finalcity );
int n=0;
while(p ){
if(strcmp(finalcity,p->finalcity )==0)
{printf("%s %s %d %d %d %d",p->finalcity,p->flight_no,p->time,p->price,p->discount,p->remain );
n++;
}
p=p->next ;
}
printf("有此航班共%d",n);
}
flightNode *search(int nubmer,linklist2 L){
linklist2 p1,p2;
p1=L ;
p2=p1;
while(nubmer!=p1->nubmer )
{
p2=p1; p1=p1->next;
}
if (nubmer==p1->nubmer)
printf("找到该航班\n");
return(p1);
}
void main(){
linklist2 L,p;
int nubmer;
p=search(nubmer,L);
find();
}