火车票的编程
① 火车票上的编号是什么意思
火车票上的编号意思如下:
1、第一段前6位是车站代码,7-10位是窗口代码,11-14位是售票日期。
2、第二段(即15-21位)是车票号码,应该和左上角的红色数码一样,第三段的最后四位是里程数,其他的应该是加密校验码。
3、火车票面上包含多样信息,包括车型,时间,座位号等。
4、火车票上各种数据的含义 ,前面是车站和窗口代码后面是发售日期代码,票号,前面是防伪代码最后四位里程。
5、火车票票面上包含多种信息,包括乘车区间,车次,开点,座位号,座位等级,票价,发售车站等信息。

(1)火车票的编程扩展阅读:
注意事项:
不符合乘车条件的处理:
有下列行为时,除按规定补票,核收手续费以外,还必须加收应补票价50%的票款:
1.无票乘车时,补收自乘车站(不能判明时自始发站)起至到站止车票票价。持失效车票乘车按无票处理。
2.持用伪造涂改的车票乘车时,除按无票处理外并送交公安部门处理。
3.持站台票上车并在开车20分钟后仍不声明时,按无票处理。
4.持用低等级的车票乘坐高等级列车、铺位、座席时,补收所乘区间的票价差额。
5.旅客持半价票没有规定的减价凭证或不符合减价条件时,补收全价票与半价票的差额。
参考资料来源:网络-火车票
② java编程 假设有火车票1000张,创建10个线程模拟10个售票点,每个售票点100毫秒售出一张票。
packagetmp;
publicclassTest{
privatestaticintk=0;//售出票数
privatestaticintcount=1000;//总票数
(intn){
if(k<count){
k++;
System.out.println("第"+n+"售票点售出第"+k+"张票");
returntrue;
}
returnfalse;
}
{//售票点
intn;//售票点编号
publicSellPot(intn){
this.n=n;
}
publicvoidrun(){
while(sell(n)){
try{
Thread.sleep(100);
}catch(InterruptedExceptione){
e.printStackTrace();
}
}
}
}
publicstaticvoidmain(String[]args){
for(inti=1;i<=10;i++){
newSellPot(i).start();
}
}
}
//银行汇款
publicclassTest2{
privatestaticintk=0;//总汇款
(intm,inti,intn){
k+=m;
System.out.println("第"+n+"个顾客进行第"+(i+1)+"次汇款,银行接收总汇款"+k);
}
{//售票点
intn;//顾客编号
publicCostum(intn){
this.n=n;
}
publicvoidrun(){
for(inti=0;i<3;i++){
send(100,i,n);//汇款100
try{
Thread.sleep(100);
}catch(InterruptedExceptione){
e.printStackTrace();
}
}
}
}
publicstaticvoidmain(String[]args){
for(inti=1;i<=3;i++){
newCostum(i).start();
}
}
}
③ 火车票下面的编码代表什么、怎么识别火车票真伪
一、火车票下面编码说明:
1、编码组成:
火车票最下方,在条形码的下面有一串数字和字母的组合。
2、其中的含义是:
(1)第1-5位数字表示发售车票的车站代码,例如京B代码是21152,京D代码是12713,清华园,代码是12710。
(2)第6位代表售票点类型,0表示车站售票处,2表示代售点,所以京A售就对应100010,京AD售对应100012,京B售对应211520,京BD售对应211522,京D售对应127130。
(3)第7-10位数字表示售票窗口的编号。例如清华园售对应1271000001。
(4)第11-14位数字表示出售车票的日期。
(5)最后4位数字是车票上起点站到终点站之间的里程,例如Z85次北京到苏州是1379公里。
二、识别火车票真伪的方法:
1、先对光看,内有铁路路徽水印。因为车票都是用内有水印的特殊纸张制成。
2、看是否有刮和改的痕迹。一般犯罪分子常用的手法就是收集废车票,对其进行挖改.或改日期或座改卧(较少)或买短途挖改成长途。
3、直接向铁路售票部门查询或向铁路公安人员咨询。一般到问讯处查询就可以了,工作人员会把车票上的条形码输入电脑,一查便知。问讯处一般人也不多,挺方便的.你只要随便问一个在车站值勤的民警,他们对此经验丰富,一看便知,也很方便。
4、观察、手摸判断法。挖补过的车票,可通过逆光照看和手摸来鉴别,这种假票的制造者,往往是将假票上需要的站名、价格等字体,整个地从其他书、报或废票上挖下来粘贴上去,因此该字体与整个票面颜色不统一,与票面字样不一致,只要用手指轻摸票面,便会有凸出感。涂改后的假 票字迹模糊,用手指触摸会有墨迹较易识别。自行印制的假票,一般纸质较差,有的客票正面底纹斜线模糊、中断,字迹不规整、不清 楚。
④ c语言进阶编程求助“火车票销售系统”
可以用数据库系统来做
核心数据结构应该是票,应该包括: 车次 出发日期 出发站 到达站 车厢 座位 是否已出售 购票人 证件号 等字段属性
然后所有的操作都可以转化为 添加、修改票数据
比如买了 现有一张票 0001 {T90、2012-1-1 出发、A 站出发、到达B站、未出售...}
那么 买票操作就是 票0001的是“否已出售” “购票人” "证件号" 做响应修改
如果 只买AB站的一个区间C、D那么还要修改出发站和到达站 同时添加另外2张新票数据 A到C的哈D到B的票 哈哈有点饶人
添加车次就按照列车的实际情况 一次型的向系统数据库里添加 若干张票的shu
⑤ c语言编程,购买车票, 乘1-4站3元/位;5-9站4元/位,9站5元一位,求应付款
#include <stdio.h>
int pay(int n);
int main(){
int n;
printf("请输入乘车站数:\n");
scanf("%d",&n);
printf("需付款%d元\n",pay(n));
return 0;
}
int pay(int n){
if(n>=1 && n<=4){
return 3;
}else if(n>=5 && n<=9){
return 4;
}else if(n==9){
return 5;
}else{
return 999;//输入有误
}
}
⑥ 急求“火车票管理系统“编程,采用C或C++实现
你这个工程可不算小,还是自己做吧
⑦ 要求用C语言编程,在Visual C++环境下调试完成火车票信息管理系统。【加急!!!】【最好有注释。】
这个估计得花人民币,才有人接手,不是个小活
⑧ C语言编程 车票管理系统
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
# define size 10 struct t_tickets /* 定义结构体 */ {int number; /* 结构体中的申明部分 */ char begin [10]; char start[30]; char loadend[30]; float time; int people; int booked; } t[size]; FILE*fp; struct t_tickets t[size];
void save()
{
int i; if ((fp=fopen("ticket.text","w+"))==NULL)
{
printf("cannot open the file\n");
return;
}
for(i=0;i<size;i++)
if(fwrite(&t[i],sizeof(struct t_tickets),1,fp)!=1)
printf(" file write error\n");
fclose(fp);
}
void input()
{
int i;
printf("----------请录入班次信息----------\n");
for(i=0;i<size;i++)
{
scanf("%d %s %s %s %f %d %d",&t[i].number,t[i].begin, t[i].start,t[i].loadend,&t[i].time,&t[i].people,&t[i].booked);
save();} }
void output()
{
int i ;
fp=fopen("ticket.text","r");for(i=0;i<size;i++)
{
fread(&t[i],sizeof(struct t_tickets ),1,fp);printf("\n%-4d %-8s %-13s %-13s %-6.1f %-6d %4d\n",t[i].number,t[i].begin, t[i].start,t[i].loadend,t[i].time,t[i].people,t[i].booked);
}
fclose(fp);} void scan(){
int k;int number;
printf("请输入您想要查询的班次号:\n");
scanf("%d",&number);
fp=fopen("ticket.text","r");
for(k=0;k<size;k++)
{
fread(&t[k],sizeof(struct t_tickets),1,fp);
if(number==t[k].number)
{ printf("\n 班次 发车时间 起点站 终点站 行车时间 额定载量 已订票人数 \n");
printf("\n%-4d %-8s %-13s %-13s %-6.1f %-6d %4d\n",t[k].number,t[k].begin, t[k].start,t[k].loadend,t[k].time,t[k].people,t[k].booked);
break;
}
}
if(k>=size)
printf("对不起,没有您想要查询的班次,谢谢使用本系统\n");
fclose(fp);
} void check()
{
int i; char loadend[30];
printf("请输入你想要查询的终点站的名称:\n");
scanf("%s",loadend);
fp=fopen("ticket.text","r");
for(i=0;i<size;i++)
{
fread(&t[i],sizeof(struct t_tickets),1,fp);
if(strcmp(loadend,t[i].loadend)==0)
{
printf("\n 班次 发车时间 起点站 终点站 行车时间 额定载量 已订票人数 \n"); printf("\n%-4d %-8s %-13s %-13s %-6.1f %-6d %4d\n",t[i].number,t[i].begin, t[i].start,t[i].loadend,t[i].time,t[i].people,t[i].booked);
break;
}
}
if(i>=size)
printf("对不起,没有您想要查询的班次,谢谢使用本系统!\n");
fclose(fp);
} void book(){
int i;int number;int m;char loadend[30];int ticket=1;
if ((fp=fopen("ticket.text","r"))==NULL)
{
printf("not open the file\n");
return;
}
for(i=0;i<=1;i++)
fread(&t[i],sizeof(struct t_tickets),1,fp);
printf("\n请输入你想要到达的终点站:\n");
scanf("%s",loadend);
printf("到达此终点站的班次有:\n");
printf("\n 班次 发车时间 起点站 终点站 行车时间 额定载量 已订票人数 \n");
for(i=0;i<=1;i++)
if(strcmp(loadend,t[i].loadend)==0)
{
ticket=2;
printf("\n 班次 发车时间 起点站 终点站 行车时间 额定载量 已订票人数 \n");
printf("\n%-4d %-8s %-13s %-13s %-6.1f %-6d %4d\n",t[i].number,t[i].begin, t[i].start,t[i].loadend,t[i].time,t[i].people,t[i].booked);
}
for(i=0;i<=1;i++)
if(strcmp (loadend,t[i].loadend)==0)
if(t[i].booked<t[i].people)
{
ticket=3;
printf("请输入订票的张数:\n");
scanf("%d",&m);
for(i=0;i<=size;i++)
if(number=t[i].number); if ((fp=fopen("ticket.text","w"))==NULL)
{
printf("not open the file\n");
return;
}
{
t[i].booked=t[i].booked+m;
if ((fp=fopen("ticket.text","w"))==NULL)
{
printf("not open the file\n");
return;
}
for(i=0;i<=size;i++) fwrite(&t[i],sizeof(struct t_tickets),1,fp); fclose(fp);
printf(" 您订票成功!谢谢使用本次服务!\n"); }} if(ticket==1)
printf("\n 没有你查询的班次,请查询后在输入\n");
if(ticket==2)
printf("\n 你想要购买的票以售完,请购买下一班 \n"); fclose(fp); if ((fp=fopen("ticket.text","w"))==NULL)
{
printf("not open the file\n");
return;
} for(i=0;i<=size;i++)
fwrite(&t[i],sizeof(struct t_tickets),1,fp); fclose(fp);
} void rback(){
int number,i,m;if((fp=fopen("ticket.text","r"))==NULL)
{
printf("not open the file\n");
return;
}for(i=0;i<=1;i++)
fread(&t[i],sizeof(struct t_tickets),1,fp);
printf("请输入退票的班次:\n");
scanf("%d",&number);
printf("请输入退票的张数:\n");
scanf("%d",&m);
for(i=0;i<=size;i++)
if(number==t[i].number)
{
t[i].booked=t[i].booked-m;
printf("\n 您退票成功!,谢谢\n");}
fclose(fp); if ((fp=fopen("ticket.text","w"))==NULL)
{
printf("not open the file\n");
return;
}
for(i=0;i<=size;i++) fwrite(&t[i],sizeof(struct t_tickets),1,fp); fclose(fp);
}
void over()
{
printf("\n 谢谢您的使用,请按任意键结束!\n");
return;
}
void main(){
int b; printf(" 这里是车票管理系统,欢迎你的使用\n");
printf(" 袁宏杰 制作\n");
printf("\n******************************************\n");
printf(" ==== 0,录入班次信息\n");
printf(" ==== 1,浏览信息\n");
printf(" ==== 2,按班次查询\n");
printf(" ==== 3,按终点站查询\n");
printf(" ==== 4,预定车票\n");
printf(" ==== 5,退票 \n");
printf(" ==== 6,退出程序\n");
printf("\n******************************************\n");
do{
printf("-----选择主菜单功能(0~6\n");
scanf("%d",&b);
switch (b)
{
case 0: input(); break;
case 1: output(); break;
case 2: scan(); break;
case 3: check(); break;
case 4: book(); break;
case 5: rback(); break;
case 6: over(); break;
default: printf(" enter error!\n");
}}while(1);}
⑨ 用java语言编写一个火车站售票系统,要求如下
这个不难,我正好有个类似的模板,稍微修改下文字,调整下就可以用了。
⑩ c语言车票订购系统
#include
#include
#include
#include
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 people*next ;
}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->data.num,num)==0)
{
printf("the train '%s'has been born!\n",num);
return ;
}
s = s->next ;
}
p = (struct node*)malloc(sizeof(struct node));
strcpy(p->data.num,num);
printf("Input the city where the train will reach:");
scanf("%s",p->data.city);
printf("Input the time which the train take off:");
scanf("%s",p->data.takeoffTime);
printf("Input the time which the train receive:");
scanf("%s",&p->data.receiveTime);
printf("Input the price of ticket:");
scanf("%d",&p->data.price);
printf("Input the number of booked tickets:");
scanf("%d",&p->data.bookNum);
p->next=NULL ;
r->next=p ;
r=p ;
shoudsave = 1 ;
}
}
/*打印火车票信息*/
void printTrainInfo(struct node*p)
{
puts("\nThe following is the record you want:");
printf(">>number of train: %s\n",p->data.num);
printf(">>city the train will reach: %s\n",p->data.city);
printf(">>the time the train take off: %s\nthe time the train reach:
%s\n",p->data.takeoffTime,p->data.receiveTime);
printf(">>the price of the ticket: %d\n",p->data.price);
printf(">>the number of booked tickets:
%d\n",p->data.bookNum);
}
struct node * Locate1(Link l,char findmess[],char numorcity[])
{
Node*r ;
if(strcmp(numorcity,"num")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
return r ;
r=r->next ;
}
}
else if(strcmp(numorcity,"city")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.city,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)
{
Node*r[10],*p ;
char ch,dem ;
bookMan*v,*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->data.city,str)==0)
{
r[i]=p ;
i++;
}
p=p->next ;
}
printf("\n\nthe number of record have %d\n",i);
for(t=0;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->data.name,str1);
printf("Input your id: ");
scanf("%s",&str2);
strcpy(h->data.num,str2);
printf("Input your bookNum: ");
scanf("%d",&dem);
h->data.bookNum=dem ;
h->next=NULL ;
v->next=h ;
v=h ;
printf("\nLucky!you have booked a ticket!");
getch();
shoudsave=1 ;
}
}
}
bookMan*Locate2(bookManLink k,char findmess[])
{
bookMan*r ;
r=k->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
{
mark=1 ;
return r ;
}
r=r->next ;
}
return 0 ;
}
/*修改火车信息*/
void UpdateInfo(Link l)
{
Node*p ;
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->data.num);
printf("Input new city the train will reach:");
scanf("%s",&p->data.city);
printf("Input new time the train take off");
scanf("%s",&p->data.takeoffTime);
printf("Input new time the train reach:");
scanf("%s",&p->data.receiveTime);
printf("Input new price of the ticket::");
scanf("%d",&p->data.price);
printf("Input new number of people who have booked ticket:");
scanf("%d",&p->data.bookNum);
printf("\nmodifying record is sucessful!\n");
shoudsave=1 ;
}
else
printf("\t\t\tcan't find the record!");
}
}
else
mark1=0 ;
}
}
/*系统给用户的提示信息*/
void AdvicedTrains(Link l)
{
Node*r ;
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->data.city,str)==0&&r->data.bookNum<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)
{
FILE*fp ;
Node*p ;
int count=0,flag=1 ;
fp=fopen("c:\\train.txt","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)
{
FILE*fp ;
bookMan*p ;
int count=0,flag=1 ;
fp=fopen("c:\\man.txt","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()
{
FILE*fp1,*fp2 ;
Node*p,*r ;
char ch1,ch2 ;
Link l ;
bookManLink k ;
bookMan*t,*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:\\train.txt","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:\\man.txt","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)
{
system("cls");
printInterface();
printf("please choose the operation: ");
scanf("%d",&sel);
system("cls");
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;
}
