南京地铁售票的C++实现

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include

#include

using namespace std;

#include

#include

HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);

char start[80],end[80];//保存当前站点和目的站点的数组

int GetCurX()

{

int curX;

HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);

CONSOLE_SCREEN_BUFFER_INFO bInfo;

GetConsoleScreenBufferInfo(hout,&bInfo);

curX=bInfo.dwCursorPosition.X;

return curX;

}

int GetCurY()

{

int curY;

HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);

CONSOLE_SCREEN_BUFFER_INFO bInfo;

GetConsoleScreenBufferInfo(hout,&bInfo);

curY=bInfo.dwCursorPosition.Y;

return curY;

}

void GotoXY(int x,int y)

{

HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);

COORD pos;

pos.X=x;

pos.Y=y;

SetConsoleCursorPosition(hout,pos);

}

void Move()

{

HANDLE hout=GetStdHandle(STD_OUTPUT_HANDLE);

HANDLE hin=GetStdHandle(STD_INPUT_HANDLE);

INPUT_RECORD mouseRec;

DWORD res;

for(;;)

{

ReadConsoleInput(hin,&mouseRec,1,&res);

SetConsoleCursorPosition(hout,mouseRec.Event.MouseEvent.dwMousePosition);

if(mouseRec.Event.MouseEvent.dwEventFlags==0)

{

if(mouseRec.Event.MouseEvent.dwButtonState==0)

{

break;

}

}

}

}

void draw_picture()

{

SetConsoleTextAttribute(hout,0x0E);//亮黄色

GotoXY(0,0);cout<<"〖南京地铁运营线路图〗";

//画一号线路图,包括南延线

SetConsoleTextAttribute(hout,0x0A);//亮绿色

GotoXY(35,33);cout<<"南京地铁一号线";

GotoXY(40,1);cout<<"⊙奥体中心";

GotoXY(40,2);cout<<"┃";

SetConsoleTextAttribute(hout,0xE9);

GotoXY(40,3);cout<<"●元通";

SetConsoleTextAttribute(hout,0x0A);

GotoXY(40,4);cout<<"┃";

GotoXY(40,5);cout<<"⊙中胜";

GotoXY(40,6);cout<<"┃";

GotoXY(40,7);cout<<"⊙小行";

GotoXY(40,8);cout<<"┃";

SetConsoleTextAttribute(hout,0xB9);

GotoXY(40,9);cout<<"◆安德门";

SetConsoleTextAttribute(hout,0x0A);

GotoXY(40,10);cout<<"┃";

GotoXY(40,11);cout<<"⊙中华门";

GotoXY(40,12);cout<<"┃";

GotoXY(40,13);cout<<"⊙三山街";

GotoXY(40,14);cout<<"┃";

GotoXY(40,15);cout<<"⊙张府园";

GotoXY(40,16);cout<<"┃";

SetConsoleTextAttribute(hout,0xE9);

GotoXY(40,17);cout<<"●新街口";

SetConsoleTextAttribute(hout,0x0A);

GotoXY(40,18);cout<<"┃";

GotoXY(40,19);cout<<"⊙珠江路";

GotoXY(40,20);cout<<"┃";

GotoXY(40,21);cout<<"⊙鼓楼";

GotoXY(40,22);cout<<"┃";

GotoXY(40,23);cout<<"⊙玄武门";

GotoXY(40,24);cout<<"┃";

GotoXY(40,25);cout<<"⊙新模范马路";

GotoXY(40,26);cout<<"┃";

GotoXY(40,27);cout<<"⊙南京站";

GotoXY(40,28);cout<<"┃";

GotoXY(40,29);cout<<"⊙红山动物园";

GotoXY(40,30);cout<<"┃";

GotoXY(40,31);cout<<"⊙迈皋桥";

/*南延线*/

GotoXY(3,8);cout<<"南京地铁一号线南延线";

GotoXY(2,9);cout<<"┏━━━━━━━━━━━━━━━━━━"; GotoXY(2,10);cout<<"⊙天隆寺";

GotoXY(2,11);cout<<"┃";

GotoXY(2,12);cout<<"⊙软件大道";

GotoXY(2,13);cout<<"┃";

GotoXY(2,14);cout<<"⊙花神庙";

GotoXY(2,15);cout<<"┃";

GotoXY(2,16);cout<<"⊙南京南站";

GotoXY(2,17);cout<<"┃";

GotoXY(2,18);cout<<"⊙双龙大道";

GotoXY(2,19);cout<<"┃";

GotoXY(2,20);cout<<"⊙河定桥";

GotoXY(2,21);cout<<"┃";

GotoXY(2,22);cout<<"⊙胜太路";

GotoXY(2,23);cout<<"┃";

GotoXY(2,24);cout<<"⊙百家湖";

GotoXY(2,25);cout<<"┃";

GotoXY(2,26);cout<<"⊙小龙湾";

GotoXY(2,27);cout<<"┃";

GotoXY(2,28);cout<<"⊙竹山路";

GotoXY(2,29);cout<<"┃";

GotoXY(2,30);cout<<"⊙天印大道";

GotoXY(2,31);cout<<"┃";

GotoXY(2,32);cout<<"⊙龙眠大道";

GotoXY(2,33);cout<<"┃";

GotoXY(2,34);cout<<"⊙南医大";

GotoXY(2,35);cout<<"┃";

GotoXY(2,36);cout<<"⊙南京交院";

GotoXY(2,37);cout<<"┃";

GotoXY(2,38);cout<<"⊙中国药科大学";

//画二号线路图

相关文档
最新文档