欢迎来到天天文库
浏览记录
ID:47549996
大小:35.56 KB
页数:55页
时间:2020-01-14
《全国交通咨询模拟系统源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、12050741班(郭晓湛,李佳豪,廖川,杨鹤)课题:全国交通系统咨询模拟源程序代码:#include#include#include#include#include#include#defineINF65535//定义一个最大数定为无穷值#defineMAX23usingnamespacestd;staticintc_number=10;staticintk=0;staticintv=0,z=0,r=0,t=0;typedefstructsearch{in
2、tc_transer;intc_cost;intc_time;intf_cost;intf_time;}search;searchm[20],x[20],n[20];typedefintcostAdj[MAX+1][MAX+1];//图邻接矩阵从1开始记数intPath[MAX+1][MAX+1];//图邻接矩阵从1开始记数typedefstructunDiGraph{intnumVerts;//结点costAdjcost;//邻接矩阵}unDiGraph,*UNG;//图的定义typedefstructc_edit{chara[10];}c_edit;c_editadd
3、[10];costAdjB,L;//定位函数,输出城市列表,增添城市。intpr(inti,intj){inth=0;if(j==0){h=i;}elseif(j==1){cin>>add[i].a;}switch(h)//运用switch语句。{case(0):cout<<"";break;case(1):cout<<"成都";break;case(2):cout<<"西安";break;case(3):cout<<"郑州";break;case(4):cout<<"武汉";break;case(5):cout<<"株洲";break;case(6):cout<<"贵阳
4、";break;case(7):cout<<"柳州";break;case(8):cout<<"广州";break;case(9):cout<<"南宁";break;case(10):cout<<"徐州";break;default:cout<5、(i,0);}cout<6、number+1;j++){G->cost[i][j]=INF;//初始化使G->cost[i][j]为无穷。}}G->numVerts=c_number;G->cost[1][2]=G->cost[2][1]=112;G->cost[1][6]=G->cost[6][1]=190;G->cost[2][3]=G->cost[3][2]=136;G->cost[2][5]=G->cost[5][2]=325;G->cost[3][4]=G->cost[4][3]=142;G->cost[3][5]=G->cost[5][3]=230;G->cost[3][6]=G->co7、st[6][3]=213;G->cost[4][7]=G->cost[7][4]=247;G->cost[4][8]=G->cost[8][4]=250;G->cost[5][7]=G->cost[7][5]=161;G->cost[5][9]=G->cost[9][5]=208;G->cost[5][10]=G->cost[10][5]=261;G->cost[6][8]=G->cost[8][6]=317;G->cost[7][8]=G->cost[8][7]=208;G->cost[8][10]=G->cost[10][
5、(i,0);}cout<6、number+1;j++){G->cost[i][j]=INF;//初始化使G->cost[i][j]为无穷。}}G->numVerts=c_number;G->cost[1][2]=G->cost[2][1]=112;G->cost[1][6]=G->cost[6][1]=190;G->cost[2][3]=G->cost[3][2]=136;G->cost[2][5]=G->cost[5][2]=325;G->cost[3][4]=G->cost[4][3]=142;G->cost[3][5]=G->cost[5][3]=230;G->cost[3][6]=G->co7、st[6][3]=213;G->cost[4][7]=G->cost[7][4]=247;G->cost[4][8]=G->cost[8][4]=250;G->cost[5][7]=G->cost[7][5]=161;G->cost[5][9]=G->cost[9][5]=208;G->cost[5][10]=G->cost[10][5]=261;G->cost[6][8]=G->cost[8][6]=317;G->cost[7][8]=G->cost[8][7]=208;G->cost[8][10]=G->cost[10][
6、number+1;j++){G->cost[i][j]=INF;//初始化使G->cost[i][j]为无穷。}}G->numVerts=c_number;G->cost[1][2]=G->cost[2][1]=112;G->cost[1][6]=G->cost[6][1]=190;G->cost[2][3]=G->cost[3][2]=136;G->cost[2][5]=G->cost[5][2]=325;G->cost[3][4]=G->cost[4][3]=142;G->cost[3][5]=G->cost[5][3]=230;G->cost[3][6]=G->co
7、st[6][3]=213;G->cost[4][7]=G->cost[7][4]=247;G->cost[4][8]=G->cost[8][4]=250;G->cost[5][7]=G->cost[7][5]=161;G->cost[5][9]=G->cost[9][5]=208;G->cost[5][10]=G->cost[10][5]=261;G->cost[6][8]=G->cost[8][6]=317;G->cost[7][8]=G->cost[8][7]=208;G->cost[8][10]=G->cost[10][
此文档下载收益归作者所有