网上如何预订火车票啊

网上如何预订火车票啊,第1张

网上购买火车票,大可按照以下步骤进行:

首先,登入中国铁路客户服务中心(12306网。)打开网站后,在网站首页的最新动态上标有“为保障您顺畅购票,请下载安装根证书。”用鼠标点击根证书(这三个字用了红色标注),然后下载根证书到电脑上。随后,解压,安装。解压后有两个文件:SRCA和SRCA根证书安装说明手册。安装过程详见SRCA根证书安装说明手册。

其次,到网站上注册个人信息,需要填写包含个人的身份z号和真实姓名等资料。注册完毕,到信箱里点击链接,激活注册用户。

第三,登录个人信息,进入我的12306,点击右侧的红色字体:车票预订。

第四,在车票查询中,包括出发地、目的地、出发日期,当然,你还可以选择具体的出发时间和出发车次,点击右侧的查询,下方将会跳出所有的车次和余票等信息。乘客可根据需要选择预订。

第五,点击右侧的预订,进入新的订票页面,选择席别(商务座、一等座、二等座)、票种(成人票、儿童票、学生票、残军票),然后填写自己的姓名、选择相关身份z件,填写证件号、手机号。其中,“有”代表票源充足,“无”代表票已售完,“——”代表无此席别。最后,输入验证码,点击提交订单。然后在15分钟内,通过网上银行完成支付。在此期间,也可以取消订单。

需要提醒网上购票的市民,购买成功后必须在15分钟内通过网上支付火车票价,否则火车票会重新流入市场。

2、取票时,可凭购票时所使用的乘车人有效二代居民身份z原件到全国火车站的任意售票窗口、铁路客票代售点或车站自动售票机上办理换票手续,纸质车票票面载明旅客姓名和购票时所使用的乘车人有效身份z件号码,并标记“网”字。

3、在火车站的任意售票窗口或车站自动售票机上办理换票手续的不收费。在铁路客票代售点办理换票手续的收取5元的服务费

下面是一个火车售票的程序,你改成飞机就可以了

#include <conioh>

#include <stdioh>

#include <stdlibh>

#include <stringh>

int shoudsave=0 ;

int count1=0,count2=0,mark=0,mark1=0 ;

/定义存储火车信息的结构体/

struct train

{

char num[10];/列车号/

char city[10];/目的城市/

char takeoffTime[10];/发车时间/

char receiveTime[10];/到达时间/

int price;/票价/

int bookNum ;/票数/

};

/订票人的信息/

struct man

{

char num[10];/ID/

char name[10];/姓名/

int bookNum ;/需求的票数/

};

/定义火车信息链表的结点结构/

typedef struct node

{

struct train data ;

struct node next ;

}Node,Link ;

/定义订票人链表的结点结构/

typedef struct people

{

struct man data ;

struct peoplenext ;

}bookMan,bookManLink ;

/ 初始界面/

void printInterface()

{

puts("");

puts(" Welcome to use the system of booking tickets ");

puts("");

puts(" You can choose the operation: ");

puts(" 1:Insert a train information ");

puts(" 2:Inquire a train information ");

puts(" 3:Book a train ticket ");

puts(" 4:Update the train information ");

puts(" 5:Advice to you about the train ");

puts(" 6:save information to file ");

puts(" 7:quit the system ");

puts("");

}

/添加一个火车信息/

void InsertTraininfo(Link linkhead)

{

struct node p,r,s ;

char num[10];

r = linkhead ;

s = linkhead->next ;

while(r->next!=NULL)

r=r->next ;

while(1)

{

printf("please input the number of the train(0-return)");

scanf("%s",num);

if(strcmp(num,"0")==0)

break ;

/判断是否已经存在/

while(s)

{

if(strcmp(s->datanum,num)==0)

{

printf("the train '%s'has been born!\n",num);

return ;

}

s = s->next ;

}

p = (struct node)malloc(sizeof(struct node));

strcpy(p->datanum,num);

printf("Input the city where the train will reach:");

scanf("%s",p->datacity);

printf("Input the time which the train take off:");

scanf("%s",p->datatakeoffTime);

printf("Input the time which the train receive:");

scanf("%s",&p->datareceiveTime);

printf("Input the price of ticket:");

scanf("%d",&p->dataprice);

printf("Input the number of booked tickets:");

scanf("%d",&p->databookNum);

p->next=NULL ;

r->next=p ;

r=p ;

shoudsave = 1 ;

}

}

/打印火车票信息/

void printTrainInfo(struct nodep)

{

puts("\nThe following is the record you want:");

printf(">>number of train: %s\n",p->datanum);

printf(">>city the train will reach: %s\n",p->datacity);

printf(">>the time the train take off: %s\nthe time the train reach: %s\n",p->datatakeoffTime,p->datareceiveTime);

printf(">>the price of the ticket: %d\n",p->dataprice);

printf(">>the number of booked tickets: %d\n",p->databookNum);

}

struct node Locate1(Link l,char findmess[],char numorcity[])

{

Noder ;

if(strcmp(numorcity,"num")==0)

{

r=l->next ;

while(r)

{

if(strcmp(r->datanum,findmess)==0)

return r ;

r=r->next ;

}

}

else if(strcmp(numorcity,"city")==0)

{

r=l->next ;

while(r)

{

if(strcmp(r->datacity,findmess)==0)

return r ;

r=r->next ;

}

}

return 0 ;

}

/查询火车信息/

void QueryTrain(Link l)

{

Node p ;

int sel ;

char str1[5],str2[10];

if(!l->next)

{

printf("There is not any record !");

return ;

}

printf("Choose the way:\n>>1:according to the number of train;\n>>2:according to the city:\n");

scanf("%d",&sel);

if(sel==1)

{

printf("Input the the number of train:");

scanf("%s",str1);

p=Locate1(l,str1,"num");

if(p)

{

printTrainInfo(p);

}

else

{

mark1=1 ;

printf("\nthe file can't be found!");

}

}

else if(sel==2)

{

printf("Input the city:");

scanf("%s",str2);

p=Locate1(l,str2,"city");

if(p)

{

printTrainInfo(p);

}

else

{

mark1=1 ;

printf("\nthe file can't be found!");

}

}

}

/订票子模块/

void BookTicket(Link l,bookManLink k)

{

Noder[10],p ;

char ch,dem ;

bookManv,h ;

int i=0,t=0 ;

char str[10],str1[10],str2[10];

v=k ;

while(v->next!=NULL)

v=v->next ;

printf("Input the city you want to go: ");

scanf("%s",&str);

p=l->next ;

while(p!=NULL)

{

if(strcmp(p->datacity,str)==0)

{

r[i]=p ;

i++;

}

p=p->next ;

}

printf("\n\nthe number of record have %d\n",i);

for(t=0;t<i;t++)

printTrainInfo(r[t]);

if(i==0)

printf("\n\t\t\tSorry!Can't find the train for you!\n");

else

{

printf("\ndo you want to book it<1/0>\n");

scanf("%d",&ch);

if(ch == 1)

{

h=(bookMan)malloc(sizeof(bookMan));

printf("Input your name: ");

scanf("%s",&str1);

strcpy(h->dataname,str1);

printf("Input your id: ");

scanf("%s",&str2);

strcpy(h->datanum,str2);

printf("Input your bookNum: ");

scanf("%d",&dem);

h->databookNum=dem ;

h->next=NULL ;

v->next=h ;

v=h ;

printf("\nLucky!you have booked a ticket!");

getch();

shoudsave=1 ;

}

}

}

bookManLocate2(bookManLink k,char findmess[])

{

bookManr ;

r=k->next ;

while(r)

{

if(strcmp(r->datanum,findmess)==0)

{

mark=1 ;

return r ;

}

r=r->next ;

}

return 0 ;

}

/修改火车信息/

void UpdateInfo(Link l)

{

Nodep ;

char findmess[20],ch ;

if(!l->next)

{

printf("\nthere isn't record for you to modify!\n");

return ;

}

else

{

QueryTrain(l);

if(mark1==0)

{

printf("\nDo you want to modify it\n");

getchar();

scanf("%c",&ch);

if(ch=='y');

{

printf("\nInput the number of the train:");

scanf("%s",findmess);

p=Locate1(l,findmess,"num");

if(p)

{

printf("Input new number of train:");

scanf("%s",&p->datanum);

printf("Input new city the train will reach:");

scanf("%s",&p->datacity);

printf("Input new time the train take off");

scanf("%s",&p->datatakeoffTime);

printf("Input new time the train reach:");

scanf("%s",&p->datareceiveTime);

printf("Input new price of the ticket::");

scanf("%d",&p->dataprice);

printf("Input new number of people who have booked ticket:");

scanf("%d",&p->databookNum);

printf("\nmodifying record is sucessful!\n");

shoudsave=1 ;

}

else

printf("\t\t\tcan't find the record!");

}

}

else

mark1=0 ;

}

}

/系统给用户的提示信息/

void AdvicedTrains(Link l)

{

Noder ;

char str[10];

int mar=0 ;

r=l->next ;

printf("Iuput the city you want to go: ");

scanf("%s",str);

while(r)

{

if(strcmp(r->datacity,str)==0&&r->databookNum<200)

{

mar=1 ;

printf("\nyou can select the following train!\n");

printf("\n\nplease select the fourth operation to book the ticket!\n");

printTrainInfo(r);

}

r=r->next ;

}

if(mar==0)

printf("\n\t\t\tyou can't book any ticket now!\n");

}

/保存火车信息/

void SaveTrainInfo(Link l)

{

FILEfp ;

Nodep ;

int count=0,flag=1 ;

fp=fopen("c:\\traintxt","wb");

if(fp==NULL)

{

printf("the file can't be opened!");

return ;

}

p=l->next ;

while(p)

{

if(fwrite(p,sizeof(Node),1,fp)==1)

{

p=p->next ;

count++;

}

else

{

flag=0 ;

break ;

}

}

if(flag)

{

printf("the number of the record which have been saved is %d\n",count);

shoudsave=0 ;

}

fclose(fp);

}

/保存订票人的信息/

void SaveBookmanInfo(bookManLink k)

{

FILEfp ;

bookManp ;

int count=0,flag=1 ;

fp=fopen("c:\\mantxt","wb");

if(fp==NULL)

{

printf("the file can't be opened!");

return ;

}

p=k->next ;

while(p)

{

if(fwrite(p,sizeof(bookMan),1,fp)==1)

{

p=p->next ;

count++;

}

else

{

flag=0 ;

break ;

}

}

if(flag)

{

printf("the number of the record which have been saved is %d\n",count);

shoudsave=0 ;

}

fclose(fp);

}

int main()

{

FILEfp1,fp2 ;

Nodep,r ;

char ch1,ch2 ;

Link l ;

bookManLink k ;

bookMant,h ;

int sel ;

l=(Node)malloc(sizeof(Node));

l->next=NULL ;

r=l ;

k=(bookMan)malloc(sizeof(bookMan));

k->next=NULL ;

h=k ;

fp1=fopen("c:\\traintxt","ab+");

if((fp1==NULL))

{

printf("can't open the file!");

return 0 ;

}

while(!feof(fp1))

{

p=(Node)malloc(sizeof(Node));

if(fread(p,sizeof(Node),1,fp1)==1)

{

p->next=NULL ;

r->next=p ;

r=p ;

count1++;

}

}

fclose(fp1);

fp2=fopen("c:\\mantxt","ab+");

if((fp2==NULL))

{

printf("can't open the file!");

return 0 ;

}

while(!feof(fp2))

{

t=(bookMan)malloc(sizeof(bookMan));

if(fread(t,sizeof(bookMan),1,fp2)==1)

{

t->next=NULL ;

h->next=t ;

h=t ;

count2++;

}

}

fclose(fp2);

while(1)

{

clrscr();

printInterface();

printf("please choose the operation: ");

scanf("%d",&sel);

clrscr();

if(sel==8)

{

if(shoudsave==1)

{

getchar();

printf("\nthe file have been changed!do you want to save it(y/n)\n");

scanf("%c",&ch1);

if(ch1=='y'||ch1=='Y')

{

SaveBookmanInfo(k);

SaveTrainInfo(l);

}

}

printf("\nThank you!!You are welcome too\n");

break ;

}

switch(sel)

{

case 1 :

InsertTraininfo(l);break ;

case 2 :

QueryTrain(l);break ;

case 3 :

BookTicket(l,k);break ;

case 4 :

UpdateInfo(l);break ;

case 5 :

AdvicedTrains(l);break ;

case 6 :

SaveTrainInfo(l);SaveBookmanInfo(k);break ;

case 7 :

return 0;

}

printf("\nplease press any key to continue");

getch();

}

return 0;

}

各地客运站标准不一,春运期间一般提前7-15天预售车票。网上购票流程:注册会员—查询车次—预定车次—支付票款—车站取票春运期间,车票紧张,建议提前购买,推荐畅途网给您!希望您帮助到您!

google上有个开源项目组 go_home你可以参考一下

大概的思路是,填写用户名密码,发送到12306执行登陆的地址,然后接受返回的信息,包括cookie(包含sessionID),

然后在模拟网站需要的表单内容填充request发送到“查询”功能对应的地址,然后解析返回的内容

大概就是这样,具体的源代码可以去go_home获取,不过不知道是不是还兼容现在的12306

以上就是关于网上如何预订火车票啊全部的内容,包括:网上如何预订火车票啊、模拟飞机场售票的程序用C语言怎么做、德国客车模拟怎么检票,售票等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10108569.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存