我在做一个课设,是关于航班查询,下面的程序是一小部分,是航班信息的,为什么那么多错啊?高手帮我看一下,也许只是一个关键地方错了,不找出来我都没信心做下去了。
#include <iostream.h>
#include <string.h>
using namespace std;
# define N 20
typedef struct flight{
int flightnumber; //航班号
int starttime; //起飞时间
int arrivedtime; //到达时间
char start[10]; //起飞站
char arrived[10]; //终点站
}flight[N];
void flightinfo() //航班信息
{
int i=1;
flight[i].flightnumber=1351;
flight[i].starttime=0750;
flight[i].arrivedtime=1055;
flight[i].start[]="beijing";
flight[i].arrived[]="guangzhou";
i++;
flight[i].flightnumber=4951;
flight[i].starttime=1320;
flight[i].arrivedtime=1510;
flight[i].start[]="hangzhou";
flight[i].arrived[]="guilin";
i++;
flight[i].flightnumber=6101;
flight[i].starttime=0800;
flight[i].arrivedtime=0910;
flight[i].start[]="shenyang";
flight[i].arrived[]="beijing";
i++;
flight[i].flightnumber=3907;
flight[i].starttime=0820;
flight[i].arrivedtime=1020;
flight[i].start[]="beijing";
flight[i].arrived[]="shanghai";
i++;
flight[i].flightnumber=6132;
flight[i].starttime=0830;
flight[i].arrivedtime=0930;
flight[i].start[]="beijing";
flight[i].arrived[]="dalian";
i++;
flight[i].flightnumber=1343;
flight[i].starttime=0745;
flight[i].arrivedtime=1005;
flight[i].start[]="beijing";
flight[i].arrived[]="changsha";
i++;
flight[i].flightnumber=2416;
flight[i].starttime=1725;
flight[i].arrivedtime=1925;
flight[i].start[]="beijing";
flight[i].arrived[]="lanzhou";
i++;
flight[i].flightnumber=1534;
flight[i].starttime=1055;
flight[i].arrivedtime=1240;
flight[i].start[]="shanghai";
flight[i].arrived[]="tianjin";
i++;
flight[i].flightnumber=2508;
flight[i].starttime=1240;
flight[i].arrivedtime=1420;
flight[i].start[]="shanghai";
flight[i].arrived[]="wuhan";
i++;
flight[i].flightnumber=5816;
flight[i].starttime=0800;
flight[i].arrivedtime=1100;
flight[i].start[]="shanghai";
flight[i].arrived[]="kunming";
i++;
flight[i].flightnumber=9247;
flight[i].starttime=1910;
flight[i].arrivedtime=2030;
flight[i].start[]="shanghai";
flight[i].arrived[]="jinan";
i++;
flight[i].flightnumber=5260;
flight[i].starttime=1305;
flight[i].arrivedtime=1540;
flight[i].start[]="guangzhou";
flight[i].arrived[]="jinan";
i++;
flight[i].flightnumber=5252;
flight[i].starttime=2120;
flight[i].arrivedtime=2355;
flight[i].start[]="guangzhou";
flight[i].arrived[]="taiyuan";
i++;
flight[i].flightnumber=3101;
flight[i].starttime=0825;
flight[i].arrivedtime=1055;
flight[i].start[]="guangzhou";
flight[i].arrived[]="beijing";
i++;
flight[i].flightnumber=6342;
flight[i].starttime=1450;
flight[i].arrivedtime=2010;
flight[i].start[]="guangzhou";
flight[i].arrived[]="changchun";
i++;
flight[i].flightnumber=6411;
flight[i].starttime=1100;
flight[i].arrivedtime=1240;
flight[i].start[]="zhengzhou";
flight[i].arrived[]="chengdu";
i++;
flight[i].flightnumber=8731;
flight[i].starttime=1655;
flight[i].arrivedtime=1905;
flight[i].start[]="chengdu";
flight[i].arrived[]="guangzhou";
i++;
flight[i].flightnumber=4203;
flight[i].starttime=1035;
flight[i].arrivedtime=1135;
flight[i].start[]="chengdu";
flight[i].arrived[]="xian";
i++;
flight[i].flightnumber=2284;
flight[i].starttime=1540;
flight[i].arrivedtime=1800;
flight[i].start[]="chengdu";
flight[i].arrived[]="beijing";
i++;
flight[i].flightnumber=2626;
flight[i].starttime=2015;
flight[i].arrivedtime=2130;
flight[i].start[]="chengdu";
flight[i].arrived[]="changsha";
cout<<" ****************************************\n"<<endl;
cout<<" * flight informations *\n"<<endl;
cout<<" ****************************************\n"<<endl;
cout<<" flightnum starttime arrivedtime start arrived\n"<<endl;
for(i=1;i<=20;i++)
{cout<<" "<<flight[i].flightnumber<<" "<<flight[i].starttime<<" "<<flight[i].arrivedtime<<" "<<flight[i].start[]<<" "<<flight[i].arrived[]<<endl;
}
void main()
{
void flightinfo();
}