#include
#include
#include
#define MAXSIZE 2000
/*车票信息*/
typedef struct
{
char chezhan[20];/*车站*/
char checi[20];/*车次*/
char zuowei[40];/*座位*/
}Data;
/*顺序表类型定义*/
typedef struct
{
Data data[MAXSIZE];
int len;/*表长*/
}SqList;
/*统计所需的票的数量*/
int searchnum(SqList *p,char m[])
{
int i,j=0;
for(i=1;i<=p->len;i++)
{
if(strcmp(p->data[i].checi,m)==0)
{
j++;
}
}
return j;
}
/*查找*/
int search(SqList *p,char m[])
{
int i=1;
if(p->len==0)
{
return 0;
}
else
{
while(i<=p->len&&strcmp(p->data[i].checi,m)!=0)
{
i++;
}
if(i>p->len)
{
return 0;
}
}
return i;
}
/*售票*/
void del(SqList *p,int n,char m[])
{
int i,j,k;
printf("\n你已成功购买以下车票\n");
printf("\n 车站 车次 座位号\n");
for(i=1;i<=n;i++)
{
k=search(p,m);
if(k!=0)
{
printf(&#