| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 795 人关注过本帖
标题:哪位高人能来看看这个火车售票系统有什么问题?
只看楼主 加入收藏
scy251147
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-7-31
收藏
 问题点数:0 回复次数:1 
哪位高人能来看看这个火车售票系统有什么问题?

能在vc以及tc++中运行,就是不能在tc2.0里面编译,谁能看下有什么问题?

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 1000
#define PRINT "%-d%12s%12s%10s%12d\n",s[i].num,s[i].start,s[i].over,s[i].time,s[i].count
struct air
{
int num;
char start[20];
char over[20];
char time[10];
int count;
}s[N];
int i;
int m=0;
void input();
void print();
void save();
void read();
void search();
void shanchu();
void dingpiao();
void tuipiao();
void xiugai();
void main()
{

int j;

printf(" ---welcome to the train station!---\n");
printf("================================================================================\n");
do

{
printf(" -------- 1.input train information -------- \n\n"
" -------- 2.glance train information -------- \n\n"
" -------- 3.correct train information -------- \n\n"
" -------- 4.search train information -------- \n\n"
" -------- 5.delete train information -------- \n\n"
" -------- 6.book tickets -------- \n\n"
" -------- 7.release tickets -------- \n\n"
" -------- 0.exit -------- \n\n");
printf("================================================================================\n");
printf("please select your opinions from 0 to 7:\n\n");
scanf("%d",&j);
switch(j)
{
case 1:input();
break;
case 2:print();
break;
case 3:xiugai();
break;
case 4:search();
break;
case 5:shanchu();
break;
case 6:dingpiao();
break;
case 7:tuipiao();
break;
case 0:;
break;
}
}while(j!=0);
printf("thank you for your coming!\n");
}

void input()
{
char f[]="2008china";
int y;
printf("please enter your pwd and press enter:\n\n");
scanf("%s",f);
if(strcmp(f,"2008china")==0)
{
printf("please input your information:\n\n"
"ending W :\n\n");
printf("--------------------------------------------------------------------------\n");
for(i=0;i<N;i++)
{

printf("please enter your number:\n");
scanf("%d",&s[i].num);
printf("please enter your starting:\n");
scanf("%s",&s[i].start);
printf("please enter your ending:\n");
scanf("%s",&s[i].over);
printf("please enter time:\n");
scanf("%s",&s[i].time);
printf("please enter your booking numbers(number==0,then login out!):\n");
scanf("%d",&s[i].count);
m++;
printf("the %d information end? continuing with pressing any keys,press 0 end",m);
scanf("%d",&y);
if(y==0)
{
save();
print();
break;
}
}
}
else
printf("please check your pwd,thank you!\n\n");
}


void save()
{
FILE *fp,*fp1;
if((fp=fopen("chen.dat","wb"))==NULL)
{
printf("file error!\n\n");
getchar();
return;
}
if((fp1=fopen("hao.dat","wb"))==NULL)
{
printf("file error!\n\n");
getchar();
return;
}
for(i=0;i<m;i++)
if(fwrite(&s[i],sizeof(struct air),1,fp)==NULL)
printf("file error!\n\n");
fprintf(fp1,"%d",m);
fclose(fp);
fclose(fp1);
}


void read()
{
FILE *fp,*fp1;
if((fp=fopen("chen.dat","rb"))==NULL)
{
printf("error,check files,press any keys to continue");
getchar();
return;
}
if((fp1=fopen("hao.dat","rb"))==NULL)
{
printf("file error!\n\n");
getchar();
return;
}
fscanf(fp1,"%d",&m);
fclose(fp1);
for(i=0;i<m;i++)
{
fread(&s[i],sizeof(struct air),1,fp);
}
fclose(fp);
}


void print()
{
char w[10];
read();
printf("number starting ending time tickets'numbers\n");
for(i=0;i<m;i++)
{
printf(PRINT);
}
printf("press any keys to back!\n");
scanf("%s",w);
}


void search()
{
char name1[20];
char name2[20];
char ii[10];
int n,no;
do
{
printf("select your choices:\n\n");
printf("1.searching as number\n\n"
"2.searching as ending\n\n"
"3.searching as hangxian\n\n"
"0.back\n\n");
printf("select your choices form 0 to 3:\n\n"
"press any words to back:\n\n");
scanf("%d",&n);
if(n==0)
break;
switch(n)
{
case 1:
printf("input hangbanhao:\n");
scanf("%d",&no);
break;
case 2:
printf("input zhongdianzhan:\n");
scanf("%s",name2);
break;
case 3:
printf("input qishizhan:\n");
scanf("%s",name1);
printf("input zhongdianzhan:\n");
scanf("%s",name2);
break;
}
read();
for(i=0;i<m;i++)
{
if(strcmp(s[i].over,name1)==0||strcmp(s[i].over,name2)==0)
{
printf("\nsuccess!\n");
printf("hangbanhao qishizhan zhongdianzhan time jipiaoshu\n");
printf(PRINT);
break;
}
if(s[i].num==no)
{
printf("\nsuccess!\n");
printf("hangbanhao qishizhan zhongdianzhan time jipiaoshu\n");
printf(PRINT);
break;
}
}
no=0;
printf("there is no information!\n\n"
"do you want to search?press yes or no or press enter to ending !\n");
scanf("%s",ii);
}while(strcmp(ii,"yes")==0);
}


void shanchu()
{
char name1[20];
char name2[20];
char ii[10];
char f[]="2008china";
int no,n;
printf("please input pwd and press enter to the end:\n\n");
scanf("%s",f);
if(strcmp(f,"2008china")==0)
{
do
{
printf("select shanqu way and press enter to the end:\n\n");
printf("*1.hangban delete\n\n"
"*2.hangxian delete\n\n"
"*0.back\n\n");
printf("please select from 0-2:\n");
scanf("%d",&n);
if(n==0)
break;
switch(n)
{
case 1:
printf("please input hangbanhao:\n");
scanf("%d",&no);
read();
break;
case 2:
printf("please input starting name:\n");
scanf("%s",name1);
printf("please input ending name:\n");
scanf("%s",name2);
read();
break;
}
for(i=0;i<m;i++)
{
if(s[i].num==no||strcmp(s[i].start,name1)==0&&strcmp(s[i].over,name2)==0)
{
s[i]=s[m-1];
m--;
}
}
printf("no information !\n\n");
printf("continue delete\n");
printf("input yes or no or enter to the end\n");
scanf("%s",ii);
save();
if(!strcmp(ii,"yes"))
printf("press any key to back:\n");
break;
}while(n!=1&&n!=2&&n!=3&&n!=4&&n!=0);
}
else
printf("you are not asministrator,you can't use it,bye!\n\n");
}

void dingpiao()
{
int n;
char a[10];
do
{
search();
printf("input your booking numbers to continue!\n");
scanf("%d",&n);
if(n<0)
{
printf("input real numbers!\n");
break;
}
if(s[i].count!=0&&s[i].count>=n)
{
s[i].count=s[i].count-n;
save();
printf("success!\n\n");
break;
}
if(s[i].count<n)
{
printf("input real numbers:\n");
break;
}
printf("input yes or no or enter to the end\n");
scanf("%s",a);
}while(!strcmp(a,"yes"));

}


void tuipiao()
{
int n;
char a[10];
do
{
search();
printf("tuipiao numbers:\n");
scanf("%d",&n);
if(n<0)
printf("input real numbers:\n");
s[i].count=s[i].count+n;
save();
printf("success!\n\n");
printf("input yes or no or enter to the end:\n\n");
scanf("%s",a);
}while(!strcmp(a,"yes"));
getchar();
}


void xiugai()
{
struct xiu
{
int no;
char name1[20];
char name2[20];
char time[20];
int count;
}x[1];
char j[10];
char f[]="2008china";
int n;
printf("enter pwd and press enter to the end!\n\n");
scanf("%s",f);
if(strcmp(f,"2008china")==0)
{
read();
do
{
printf( "way:\n\n"
"*1,hangbanhao xiugai:\n\n"
"*2,hangxian xiugai\n\n");
printf("1-2,press enter to the end!\n\n");
scanf("%d",&n);
switch(n)
{
case 1:printf("hangbanhao:\n");
scanf("%d",&x[0].no);
break;
case 2:printf("starting:\n");
scanf("%s",x[0].name1);
printf("ending:\n");
scanf("%s",x[0].name2);
break;
}
for(i=0;i<m;i++)
{
if(strcmp(s[i].over,x[0].name1)==0&&strcmp(s[i].over,x[0].name2)==0)
{
printf("hangbanhao starting ending time jipiaoshu\n");
printf(PRINT);
break;
}
if(s[i].num==x[0].no)
{
printf("hangbanhao starting ending time jipiaoshu\n");
printf(PRINT);
break;
}
}
x[0].no=0;
printf("please enter new hangbanhao、qishizhan、zhongdianzhan、time、jipiaoshu:\n");
scanf("%d%s%s%s%d",&x[0].no,x[0].name1,x[0].name2,x[0].time,&x[0].count);
s[i].num=x[0].no;
strcpy(s[i].start,x[0].name1);
strcpy(s[i].over,x[0].name2);
strcpy(s[i].time,x[0].time);
s[i].count=x[0].count;
save();
printf("do you want to continue? please enter yes or no or enter to the end:\n\n");
scanf("%s",j);
}while(strcmp(j,"yes")==0);
}
else
printf("you are not Asministrator,you can't use it,bye!\n\n");
}


搜索更多相关主题的帖子: 高人 系统 火车 售票 
2007-09-10 16:29
scy251147
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-7-31
收藏
得分:0 
有没有人来帮我下,
2007-09-10 16:37
快速回复:哪位高人能来看看这个火车售票系统有什么问题?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039136 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved