| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3029 人关注过本帖
标题:运用链表的程序,我估计是output()和foutput()错了,但是不知道错哪了。。
只看楼主 加入收藏
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:21 
运用链表的程序,我估计是output()和foutput()错了,但是不知道错哪了。。
编译可以通过,运行可以看到主界面,但是输入选择会[local]1[/local]


程序如下:
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <windows.h>
void system_time();void load();void add();void search();void buy_ticket();void back_ticket();void output();void foutput();void search1();void search2();//申明函数
struct time
{
    int hour;
    int minute;
};
struct Ticket
{
    char number[100];//班次
    struct time ft;//列车出发时间
    char origin_station;//起始站
    char last_station[100];//终点站
    float last_time;//行车时间
    int max_number;//额定载量
    int sold_ticket;//已订票人数
    char condition[100];//状态
    struct Ticket*next;
};
int i;                        
int syshour;                    //记录系统时间小时     
int sysminute;                  //记录系统时间分钟   
char filename[100];              //文件名数组                     
int record;                     //记录条数记录

struct Ticket *head,*end,*p,*q;//全局变量,方便后面的使用
void main()
{
    int z;
    z=0;
    printf("当前时间:");
    system_time();
    printf("*******************************************\n");
    printf("            欢迎使用车票管理系统           \n");
    printf("                1.录入车票信息             \n");
    printf("                2.单个添加车次信息         \n");
    printf("                3.浏览班次信息             \n");
    printf("                4.查询路线                 \n");
    printf("                5.购票                     \n");
    printf("                6.退票                     \n");
    printf("                0.退出程序                 \n");
    printf("*******************************************\n");
    printf("请输入您想做的操作:");
    scanf("%d",&z);
    switch(z)
    {
        case 1:load();break;
        case 2:add();break;
        case 3:output(head);break;
        case 4:search();break;
        case 5:buy_ticket();break;
        case 6:back_ticket();break;
        case 7:back_ticket();break;
        case 0:break;
        default :printf("选择错误!!!");
    }
    printf("感谢您的使用!!!\n");
    }
    void system_time()
    {
        SYSTEMTIME sys;
        GetLocalTime( &sys );                //调用系统时间
        printf( "%4d /%02d/%02d %02d:%02d:%02d 星期%1d\n",
                 sys.wYear,
                 sys.wMonth,
                 sys.wDay,
                 sys.wHour,
                 sys.wMinute,
                 sys.wSecond,
                 sys.wDayOfWeek);
                 syshour=sys.wHour;            
                 sysminute=sys.wMinute;
    }
   
   
    void output(struct Ticket *head1)
    {
       struct Ticket *q;//建立量表的函数
       printf("班次\t时间\t起始站\t终点站\t行车时间\t额定载量\t已订票人数\t状态\n");
       q=head1->next;
       while(q!=NULL)
       {
              printf("%s\t%02d:%02d\t%s\t%s\t%f\t%d\t%d\t%s\n",q->number,q->ft.hour,q->ft.minute,q->origin_station,q->last_station,q->last_time,q->max_number,q->sold_ticket,q->condition);
           q=q->next;
           if((syshour>q->ft.hour)||((syshour==q->ft.hour) &&(sysminute>q->ft.minute)))
           printf("已发出\n",q->condition);
           else
           printf(" \n",q->condition);
       }
    }

    void foutput(struct Ticket *head1)
    {
        FILE*fp1;
        struct Ticket *q;
        fp1=fopen("车票班次信息.txt","w");
        if(fp1==NULL)
        {
            printf("无法打开文件!\n");
            exit(0);
        }
        q=head->next;
        while(q!=NULL)
        {
            fprintf(fp1,"%s\t%02d:%02d\t%s\t%s\t%f\t%d\t%d\n",q->number,q->ft.hour,q->ft.minute,q->origin_station,q->last_station,p->last_time,q->max_number,q->sold_ticket,q->condition);
            q=q->next;
        }
        fclose(fp1);
    }
     void load()
    {
        FILE*fp;
        fp=fopen("车票班次信息.txt","r");
        if(fp==NULL)
        {
            printf("无法打开文件");
            exit(0);
        }
        head=(struct Ticket *)malloc(sizeof(struct Ticket));
        end=head;
        end->next=NULL;
        while(!feof(fp))
        {
            p=(struct Ticket *)malloc(sizeof(struct Ticket));
            fscanf(fp,"%s%d:%02d%s%s%f%d%d\n",&p->number,&p->ft.hour,&p->ft.minute,&p->origin_station,&p->last_station,&p->last_time,&p->max_number,&p->sold_ticket,&p->condition);
            p->next=NULL;
            end->next=p;
            end=p;
        }
        output(head);
        fclose(fp);
    }
    void add()
    {
        load();
        p=(struct Ticket *)malloc(sizeof(struct Ticket));
        printf("请输入您要增加的班次:");
        scanf("%s",&p->number) ;
        printf("请输入您要增加的班次的出发时间:");
        scanf("%d:%02d",&p->ft.hour,&p->ft.minute);
        printf("请输入你要增加的班次的起始站:");
        scanf("%s",&p->origin_station);
        printf("请输入您要增加的班次的终点站:");
        scanf("%s",&p->last_station);
        printf("请输入您要增加的班次的行车时间:");
        scanf("%f",&p->last_time);
        printf("请输入您要增加的班次的额定载量");
        scanf("%d",&p->max_number);
        printf("请输入您要增加的班次的已订票人数");
        scanf("%d",&p->sold_ticket);
        p->next=NULL;
        end->next=p;
        end=p;
        foutput(head);
        output(head);
    }
    void search()
    {
        int s;
        s=0;
        printf("*****************查询菜单****************\n");
        printf("             1.按班次号查询              \n");
        printf("             2.按终点站查询              \n");
        printf("             0.返回主菜单                \n");
        printf("*****************************************\n");
        printf("请输入您想要的操作:\n");
        scanf("%d\n",&s);
        switch(s)
        {
            case 1:search1();break;
            case 2:search2();break;
            case 0:output(head);
            default:printf("选择错误!!!");
        }
    }
    void search1()
    {
        struct Ticket *p;
        char number[100];
        char i;
        printf("请输入您要查询车辆的班次号:\n");
        scanf("%d",&i);
        p=head->next;
        do
        {
            if(strcmp(number,p->number)==0)
            {
                printf("%s\t%d:%d\t%s\t%s\t%f\t%d\t%d\n",p->number,p->ft.hour,p->ft.minute,p->origin_station,p->last_station,p->last_time,p->max_number,p->sold_ticket);
                printf("\n\n");
            }
        
        }
            while(p!=NULL);
            printf("输入的班次号有误!");
        foutput(head);
        output(head);
    }
    void search2()
    {
        struct Ticket *p;
        char last_station[100];
        char c;
        printf("请输入您要查询车次的终点站:\n");
        scanf("%s",&c);
        p=head->next;
        do
        {
             if(strcmp(last_station,p->last_station)==0)
            {
              printf("%d\t\t%d:%d\t\t%s\t\t%s\t\t%f\t\t%d\t\t%d\n\n",p->number,p->ft.hour,p->ft.minute,p->origin_station,p->last_station,p->last_time,p->max_number,p->sold_ticket);
                printf("\n\n");
            }
           }    while(p!=NULL);
               foutput(head);
            output(head);
        
    }
    void buy_ticket()
    {
        int m,n;
        char number[100];
        m=0;
        load();
        printf("请输入您要买的班次号:\n");
        scanf("%s,number");
        p=head->next;
        while(p!=NULL)
        {
            if(strcmp(p->number,number)==0)
            {
                printf("请输入您要购买的票数:\n");
                scanf("%d",&n);
                if(p->sold_ticket=p->max_number)
                printf("您需要的车票已售空\n");
                else if (n>(p->max_number-p->sold_ticket))
                printf("您需要的班次车票不足\n");
                else if((syshour>p->ft.hour)||((syshour==p->ft.hour) &&(sysminute>p->ft.minute)))
                printf("您需要的班次车辆已发出\n");
                else
                {
                    p->sold_ticket=p->sold_ticket+n;
                    printf("订票成功\n");
                }
                m++;
                p=p->next;
            }   
         
        else if(m==0)
        printf("您输入的班次号有误!\n");
        else foutput(head);
        output(head);
        }
    }
    void back_ticket()
    {
        int m,n;
        char number[100];
        m=0;
        load();
        printf("请输入您要退票的班次\n");
        scanf("%s",number);
        p=head->next;
        while(p!=NULL)
        {
            if(strcmp(number,p->number)==0)
            {
                printf("请输入您要退还的票数\n");
                scanf("%d",&n);
                if((syshour>p->ft.hour)||((syshour==p->ft.hour) &&(sysminute>p->ft.minute)))
                printf("您退还的班次已发出,退票失败!");
                else
                p->sold_ticket=p->sold_ticket+n;
                m++;
            }
            if(m==0)
            printf("对不起,您输入的班次号错误!\n");
            else
            foutput(head);
            output(head);
        }
    }
   
搜索更多相关主题的帖子: include search number minute 
2016-04-28 14:49
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
收藏
得分:0 
上面的是全部的程序,这里的是output()跟foutput()
void output(struct Ticket *head1)
    {
       struct Ticket *q;//建立量表的函数
       printf("班次\t时间\t起始站\t终点站\t行车时间\t额定载量\t已订票人数\t状态\n");
       q=head1->next;
       while(q!=NULL)
       {
              printf("%s\t%02d:%02d\t%s\t%s\t%f\t%d\t%d\t%s\n",q->number,q->ft.hour,q->ft.minute,q->origin_station,q->last_station,q->last_time,q->max_number,q->sold_ticket,q->condition);
           q=q->next;
           if((syshour>q->ft.hour)||((syshour==q->ft.hour) &&(sysminute>q->ft.minute)))
           printf("已发出\n",q->condition);
           else
           printf(" \n",q->condition);
       }
    }

    void foutput(struct Ticket *head1)
    {
        FILE*fp1;
        struct Ticket *q;
        fp1=fopen("车票班次信息.txt","w");
        if(fp1==NULL)
        {
            printf("无法打开文件!\n");
            exit(0);
        }
        q=head->next;
        while(q!=NULL)
        {
            fprintf(fp1,"%s\t%02d:%02d\t%s\t%s\t%f\t%d\t%d\n",q->number,q->ft.hour,q->ft.minute,q->origin_station,q->last_station,p->last_time,q->max_number,q->sold_ticket,q->condition);
            q=q->next;
        }
        fclose(fp1);
    }
2016-04-28 14:53
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
收藏
得分:7 
p->last_time
应该是q->last_time吧

未佩好剑,转身便已是江湖
2016-04-28 15:16
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
收藏
得分:0 
回复 3楼 alice_usnet
即使是改成了q->lq->lset_time,也是同样的结果,求指导
2016-04-28 15:21
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
收藏
得分:0 
各位大神,明天就要交程序了,如果还是不能正常运行我就要挂科了,求指教啊
2016-04-28 15:27
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
收藏
得分:0 
in function foutput:
q=head->next;
q=head1->next;

p->last_time
q->last_time

未佩好剑,转身便已是江湖
2016-04-28 15:31
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
收藏
得分:0 
回复 6楼 alice_usnet
改过来了,科还是不行,选择1就会是一堆乱七八糟的东西,然后结束程序
2016-04-28 15:40
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
收藏
得分:0 
程序代码:
fscanf(fp,[color=#800000]"%s%d:%02d%s%s%f%d%d\n"[/color],&p->number,&p->ft.hour,&p->ft.minute,&p->origin_station,&p->last_station,&p->last_time,&p->max_number,&p->sold_ticket,&p->condition);
fscanf(fp,"%s%d%d%s%s%f%d%d%s",&p->number,&p->ft.hour,&p->ft.minute,&p->origin_station,&p->last_station,&p->last_time,&p->max_number,&p->sold_ticket,&p->condition);

    /*char number[100];//班次
    struct time ft;//列车出发时间 
    [color=red]char origin_station;//起始站  char origin_station[100]?
    char last_station[100];//终点站
    float last_time;//行车时间
    int max_number;//额定载量
    int sold_ticket;//已订票人数
    char condition[100];//状态 
    struct Ticket*next; [/color]*/


[此贴子已经被作者于2016-4-28 15:55编辑过]


未佩好剑,转身便已是江湖
2016-04-28 15:54
wanglianyi1
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:14
帖 子:647
专家分:2067
注 册:2015-6-18
收藏
得分:7 
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

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<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->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)
    {
        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;
}
2016-04-28 15:55
一世沉浮
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2016-4-28
收藏
得分:0 
回复 8楼 alice_usnet
改了之后好了一些
界面显示成了
图片附件: 游客没有浏览图片的权限,请 登录注册

还是没办法运行,不过已经比我之前好了许多
2016-04-28 16:03
快速回复:运用链表的程序,我估计是output()和foutput()错了,但是不知道错哪了 ...
数据加载中...
 
   



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

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