【C语言】请问我的这个嵌套switch函数里最后的括号怎么结不了尾?

jongkhurun_1112 2017-04-01 01:12:55
/************************************************
*函数名: vip_statistic(分类统计会员信息)
*功能:分类统计会员信息
*返回值:void(无返回值)
*************************************************/
void vip_statistic(VIP* head)
{
int num,num1; //子菜单选择
VIP *p1,*p2;
int flag; //flag是用来判断是否找到,
int c,total;
char h[12];
total=0;
p2=NULL;
while(1)
{
printf("\n**************统计子菜单*******************\n");
printf("1.统计会员人数\n");
printf("2.统计会员等级\n");
printf("3.返回主菜单\n");
printf("*******************************************\n");
fflush(stdin);
scanf("%d",&num); //选择你想要查询的方式
switch(num)
{
case 1:
while( head != p2)
{
p1 = head;
while( p1->next!= p2 )
{
if( p1->code > p1->next->code)
{
ch_swap(p1->clas,p1->next->clas);
ch_swap(p1->name,p1->next->name);
ch_swap(p1->sex,p1->next->sex);
ch_swap(p1->tel,p1->next->tel);
ch_swap(p1->birthday,p1->next->birthday);
in_swap(p1->times,p1->next->times);
total++;
}
}
p2= p1;

}
system("cls");
printf("共有会员人数%d人,详细信息如下",total);
printf("\n===编号====会员等级====姓名====性别===电话============生日=======消费次数===\n\n");
while(p1!=NULL)
{
printf(" %d %s %s %s %s %s %d",p1->code,p1->clas,p1->name,p1->sex,p1->tel,p1->birthday,p1->times);
printf("\n");
p1=p1->next;
}
break;


case 2:
{
while(1)
{
printf("\n**************会员等级选择*******************\n");
printf("1.普通会员\n");
printf("2.黄金会员\n");
printf("3.钻石会员\n");
printf("4.返回上一级\n");
printf("*******************************************\n");
fflush(stdin);
scanf("%d",&num1); //选择你想要查询的方式
switch(num1)
{
case 1:
while( head != p2)
{
p1 = head;
while( p1->next!= p2 )
{
if(strcmp(p1->clas,"普通会员")==0)
total++;
p1 = p1->next;
}
p2= p1;
}
system("cls");
printf("共有普通会员人数%d人,详细信息如下",total);
printf("\n===编号====会员等级====姓名====性别===电话============生日=======消费次数===\n\n");
while(p1!=NULL)
{
printf(" %d %s %s %s %s %s %d",p1->code,p1->clas,p1->name,p1->sex,p1->tel,p1->birthday,p1->times);
printf("\n");
p1=p1->next;
}
break;
case 2:
while( head != p2)
{
p1 = head;
while( p1->next!= p2 )
{
if(strcmp(p1->clas,"黄金会员")==0)
total++;
p1 = p1->next;
}
p2= p1;
}
system("cls");
printf("共有黄金会员人数%d人,详细信息如下",total);
printf("\n===编号====会员等级====姓名====性别===电话============生日=======消费次数===\n\n");
while(p1!=NULL)
{
printf(" %d %s %s %s %s %s %d",p1->code,p1->clas,p1->name,p1->sex,p1->tel,p1->birthday,p1->times);
printf("\n");
p1=p1->next;
}
break;
case 3:
while( head != p2)
{
p1 = head;
while( p1->next!= p2 )
{
if(strcmp(p1->clas,"钻石会员")==0)
total++;
p1 = p1->next;
}
p2= p1;
}
system("cls");
printf("共有钻石会员人数%d人,详细信息如下",total);
printf("\n===编号====会员等级====姓名====性别===电话============生日=======消费次数===\n\n");
while(p1!=NULL)
{
printf(" %d %s %s %s %s %s %d",p1->code,p1->clas,p1->name,p1->sex,p1->tel,p1->birthday,p1->times);
printf("\n");
p1=p1->next;
}
break;
case 4:return;
default:
printf("\n输入错误,按任意键返回选择菜单\n");
getch();
}
break;
}
}

case 3:return;
default :
printf("\n输入错误,按任意键返回统计菜单\n");getch();

有点长...但各位大佬求解啊~~~
...全文
170 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jongkhurun_1112 2017-04-01
  • 打赏
  • 举报
回复
引用 2楼赵4老师 的回复:
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。
试试
赵4老师 2017-04-01
  • 打赏
  • 举报
回复
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。
jongkhurun_1112 2017-04-01
  • 打赏
  • 举报
回复
就是最后反大括号打出来不对齐 下一个函数也一直有问题

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧