#include
#include
#include
#include //conio是控制台输入输出,比如getch()函数
/*定义地铁信息链表的结点结构*/
typedef struct stat
#include
#include
#include
#include //conio是控制台输入输出,比如getch()函数
/*定义地铁信息链表的结点结构*/
typedef struct station
{
char stopname[30]; /*站点*/
int m; //1或者0
struct station *next;
};
/*定义存储地铁信息的结构体*/
typedef struct NODE
{
char starttime[10];/*首班车时间*/
char finaltime[10];/*末班车时间*/
int stopnum;/*站数*/
struct station *next;
};
void stationinfo()
{
NODE *head1,*head2,*head3,*head4,*head5,*head6,*p,*q; //定义6条线路及两个指针
int i;
head1=q=(NODE *)malloc(sizeof(NODE)); //申请头结点,第一个节点储存首班车、末班车,站数的信息
q->next=NULL;
printf("请输入一号线的首班车时间");
scanf("%s",&NODE.starttime);
printf("请输入一号线的末班车时间");
scanf("%s",&NODE.finaltime);
printf("请输入一号线的站数");
scanf("%d",&NODE.stopnum);
q->next=p; //第二个节点开始储存站点的名字,以及确定是不是转乘站
q=p;
for(i=0;inext=NULL;
p=head->next;
}
void printfinfo()
{
printf("这条线路的信息:");
printf("%s %s %d",NODE.starttime,NODE.finaltime,NODE.stopnum);
p=p->next;
while(p!=NULL)
{
printf("%s ",station.stopname);
p=p->next;
}
}
展开
全部