| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 519 人关注过本帖
标题:[求助]关于航班信息的源程序
只看楼主 加入收藏
cky1014
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-8-8
收藏
 问题点数:0 回复次数:1 
[求助]关于航班信息的源程序

我在做一个课设,是关于航班查询,下面的程序是一小部分,是航班信息的,为什么那么多错啊?高手帮我看一下,也许只是一个关键地方错了,不找出来我都没信心做下去了。
#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();
}

搜索更多相关主题的帖子: 航班信息 
2006-08-09 20:34
cky1014
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-8-8
收藏
得分:0 

刚才改了一下
#include <iostream>
#include <string>

# define N 20
using namespace std
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();
}

还是两个错误阿~~~55555555


2006-08-09 20:48
快速回复:[求助]关于航班信息的源程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020279 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved