| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1537 人关注过本帖
标题:出现了c2601错误,不知道怎么解决,错误在主函数
只看楼主 加入收藏
MADHU
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2018-7-3
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
出现了c2601错误,不知道怎么解决,错误在主函数

void main(void)
{
    FLIGHT fltlist[M][N];
    FLIGHT* k;
    k=(FLIGHT*) fltlist;
    ReadFlight(k);
    for(;;)
    {
        char c;
        printf("\t\t\t\t 飞机订票系统\n");
        printf("----------主菜单----------\n");
        printf("\t\t\t\t 1.输入航班信息\n");
        printf("\t\t\t\t 2.输出航班信息\n");   
        printf("\t\t\t\t 3.查找航班信息\n");
        printf("\t\t\t\t a.显示空位数量\n");   
         printf("\t\t\t\t b.显示已订座信息\n");   
        printf("\t\t\t\t c.起飞时间\n");
        printf("\t\t\t\t 4.订票预约\n");   
        printf("\t\t\t\t 5.删除订票预约\n");
        printf("\t\t\t\t 6.退出系统\n");
        printf("--------------------------\n");
        printf("请选择1-6:");
        char m;
        c=getchar();
        switch(c)
        {
case'1':
    {
            shuruFlight(k);
            system("cls");
            getchar();
    }
        break;
case'2':
    {
        shuchuFlight(k);   
        system("cls");
        getchar();
    } break;
case'3':
        {if(chaxunhangban(k)=='y')
        {printf("\n请选择a-c: ");
        scanf("%c",&m);
        c='y';
        while(c=='y'||c=='Y')
        {switch(m)
        {
case'a':{chakongweigeshu(k);}
        break;
case'b':{chakongweixinxi(k);}
        break;
case'c':{chaxunyidingxinxi(k);}
        break;
case'd':{qifeishijian(k);}
        break;
default:printf("没有这个选项!\n按回车键继续其他操作。");
    getchar();
    getchar();
    break;
        }
printf("你还要查询本航班其他信息吗?(具体如下):\n");
      printf("\t\t\t\t   a.显示空座的数量\n");
      printf("\t\t\t\t   b.显示已订座信息\n");
      printf("\t\t\t\t   c.起飞时间\n");
      printf("请选择(y\n):");
      getchar();
      scanf("%c",&c);
      if(c=='y'||c='Y')
      {printf("\n请选择a-c: ");
      getchar();
      scanf("%c",&m);}
      else
      {system("cls");
      getchar();
      break;
        }
        }
        }
        else system("cls");
        }
      break;
      case'4':
      {k=(FLIGHT*) fltlist;
      book(k);
      system("cls");
      getchar();}
      break;
      case'5':
          {k=(FLIGHT*) fltlist;
          tuipiao(k);
          system("cls");
          getchar();}
          break;
      case'6':
          break;
      default;
          printf("没有这个选项!\n按回车键回主菜单。");
          getchar();
          system("cls");
          continue;}
        if(c=='6')
            break;}
 }
}}

[此贴子已经被作者于2018-7-4 00:40编辑过]

搜索更多相关主题的帖子: printf getchar case system break 
2018-07-03 23:30
MADHU
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2018-7-3
收藏
得分:0 
主函数好像没问题,是不是下面这个函数的问题
char chaxunhangban(FLIGHT *fltlist)
{
    char mn_szat[30];
    char mn_szto[30];
    FLIGHT *p;
    p=fltlist;
    int i;
    int j=0;
    int k;
    char c='y';
    while(c=='y'||c=='Y')
    {
        printf("请输入你的查询方式:\n1.按目的地.\n2.按路线查.");
        scanf("%d",&k);
        switch(k)
        {
case1:
        {
            printf("请输入起飞地:");
            scanf("%s",&mn_szat);
            for(i=0;i<M;i++)
            {
                if(strcmp((p+i*N)->m_szat,mn_szat)==0)
                {
                    j++;
                    printf("查询的航班号为:%d!\n",i);
                }
            }
            break;
        }
case2:
            {
                printf("请输入目的地:");
                scanf("%s",&mn_szto);
                for(i=0;i<M;i++)
                {
                    if(strcpy((p+i*N)->m_szto,mn_szto)==0)
                    {
                        j++;
                        printf("查询的航班号为:%d!\n",i);
                    }
                }
                break;
            }
case3:
                {
                    printf("你要查询本航班的以下信息吗?(y/n)\n");
                    goto loop;
               
        default:
            {
                printf("没有这个选项!按回车键退出查询系统");
                getchar();
            }
            break;
            }
            printf("\n你还要继续查询航班吗?(y/n)");
            getchar();
            scanf("%c",&c);
        }
        printf("你还要继续查询本航班更详细的信息吗?(具体如下):\n");
loop:
        printf("\t\t\t\t   a.显示空座的数量\n");
        printf("\t\t\t\t   b.显示已订座信息\n");
        printf("\t\t\t\t   c.起飞时间\n");
        printf("请选择(y\n):");
        getchar();
        scanf("%c",&c);
        getchar();
        return(c);
    }
2018-07-04 02:07
自学的数学
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:46
帖 子:967
专家分:4146
注 册:2017-11-15
收藏
得分:20 
根据:Compiler Error C2061 的定义。如下:
The latest version of this topic can be found at Compiler Error C2061.
syntax error : identifier 'identifier'
The compiler found an identifier where it wasn't expected. Make sure that identifier is declared before you use it.
An initializer may be enclosed by parentheses. To avoid this problem, enclose the declarator in parentheses or make it a typedef.
This error could also be caused when the compiler detects an expression as a class template argument; use typename to tell the compiler it is a type.
2018-07-04 09:41
快速回复:出现了c2601错误,不知道怎么解决,错误在主函数
数据加载中...
 
   



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

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