地铁广州东站的肯德基位置

分类: 轨道交通 时间: 2024-11-02 22:30:56 作者:551471

不要去吃,都是变异鸡,打过一种有害激素的。

地铁计费系统

#include<iostream.h>#include<string.h>#include"SinglyLinkedList.h"#include"AdjMatrixGraph.h"void reverse(SinglyLinkedList<char*> &list); void fun(SinglyLinkedList<char*> &list,char *x,char *y);void traverse();int main(){ int c=0,d=0; char* station[]={"迈皋桥","红山动物园","南京站","新模范马路","玄武门","鼓楼","珠江路", "新街口","张府园","三山街","中华门","安德门","小行","中胜","元通","奥体中心"}; SinglyLinkedList<char*> stalist(station,16); cout<<"欢迎来到南京地铁一号线"<<endl; do { cout<<"*******************************"<<endl; cout<<"***********地铁系统************"<<endl; cout<<"* 0.地铁站点一览 *"<<endl; cout<<"* 1.票价查询 *"<<endl; cout<<"* 2.乘坐地铁 *"<<endl; cout<<"* 3.地铁站点遍历 *"<<endl; cout<<"* 4.退出 *"<<endl; cout<<"*******************************"<<endl; cout<<"请选择:(0~4)"<<endl; cin>>d; switch(d) { case 0: cout<<"地铁一号线经过的站点有:"<<stalist;break; case 1:cout<<"票价为:1~7站2元、8~11站3元、12~15站4元"<<endl;break; case 2: {
char a[10],b[10]; int c; cout<<"请选择乘坐方向:0.往奥体中心方向 1.往迈皋桥方向"<<endl; cin>>c; if(c==1) reverse(stalist); cout<<"请输入起点站:"; cin>>a; cout<<"请输入终点站:"; cin>>b; fun(stalist,a,b); break; } case 3:traverse();break; case 4:break; default:cout<<"输入错误!"; } } while(d!=4); cout<<"谢谢使用"<<endl; return 0;}void fun(SinglyLinkedList<char*> &list,char *x,char *y){ int fare,n; int i=0; char *old; while(strcmp(x,list.get(i))!=0) { list.remove(i,old); } while(strcmp(y,list.get(i))!=0) { i++; } int j=0,m=list.length(); while(j<m-1-i) { list.remove(i+1,old); j++; } n=list.length()-1; cout<<"经过的站点有:"<<list; cout<<"经过的站点数:"<<n<<endl; if(n>=1&&n<=7) fare=2; if(n>=8&&n<=11) fare=3; if(n>=12&&n<=15) fare=4; cout<<"车费为:"<<fare<<"元"<<endl;}void traverse(){ char* stations[]={"珠江路","新街口","张府园","三山街","中华门","安德门","小行站","中胜站","元通站","奥体中"}; Edge edges[]={{0,1,1},{0,9,10},{1,0,1},{1,2,1},{1,9,9},{2,1,1},{2,3,1},{2,6,5},{2,8,8},{3,2,1},{3,4,1},{4,3,1}, {4,5,1},{5,4,1},{5,6,1},{5,7,3},{6,2,4},{6,5,1},{6,7,1},{7,5,3},{7,6,1},{7,8,1},{8,2,8},{8,7,1},{8,9,1},{9,0,10},{9,1,9},{9,8,1}}; AdjMatrixGraph<char*> graph(stations, 10, edges, 28); cout<<"地铁线路图的邻接矩阵:"<<endl<<graph; cout<<"请选择遍历方式:1.深度优先遍历 2.广度优先遍历"<<endl; int a; cin>>a; cout<<"请选择起始站点:0.珠江路 1.新街口 2.张府园 3.三山街 4.中华门 5.安德门 6.小行 7.中胜 8.元通 9.奥体中心"<<endl; int i; cin>>i; if(a==1) { cout<<"深度优先遍历:"<<endl; graph.DFSTraverse(i); } else { cout<<"广度优先遍历:"<<endl; graph.BFSTraverse(i); }}void reverse(SinglyLinkedList<char*> &list) { Node<char*> *p=list.head, *front=NULL; while (p!=NULL) { Node<char*> *q = p->next; p->next = front; front = p; p = q; } list.head = front; }