user-0 提问: 各位大佬帮帮忙，要参加答辩，系统没有报错，但运行不出来，应该是逻辑问题

回复:
user: user-1
content: #include<stdio.h> #include<stdlib.h> #include<time.h> #include <string.h>  /*参赛者姓名和参赛号码*/ struct competitor{     char Name[20];     int Num; }com[3];  /*用来配置机会次数，题量大小*/ struct config{     int chance;//用来存储每道题目机会次数     int topicNum;//用来存储题目数量 }con;  /*结构体award用于保存奖励语*/ struct award{     char good[30];     char well[20];     char cheers[20]; }award1;  int menu(struct competitor com[],int n); void chuangguan_mode(); void easy_mode(struct config con); void difficulty_mode(struct config con); int practice_mode(struct config con); void see(); void see1(); void see2(); void score();  int main() {     struct competitor com[3]={{"Li",1001},{"Wang",1002},{"Zhang",1003}};     struct config con={2,5};     struct award award1={"非常棒！","不错！加油","干得漂亮！"};  } int menu(struct competitor com[],int n) {     int i,j,x;     printf("\t\t\t\t模拟中学生计算大赛小游戏\n");     printf("\t\t*******************************\n");     /*     printf("请输入你的姓名:\n");     for(i=0;i<3;i++)     {         scanf("%s",com[i].Name);     }     printf("请输入你的参赛号：\n");     for(j=0;j<3;j++)     {         //scanf("%s",&com[i].Num);         scanf("%d", &com[i].Num);     }     */     for(i=0;i<3;i++) {         printf("请输入你的姓名:\n");         scanf("%s",com[i].Name);         printf("请输入你的参赛号：\n");         scanf("%d", &com[i].Num);    //不是%s      }     printf("\t\t*******************************\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[4]查看历史分数\n");     printf("\t\t\t\t[5]退出游戏\n");     printf("\t\t\t*****************************");     printf("请选择想要进行的操作:");     scanf("%d",&x);     switch(x)     {         case 1:chuangguan_mode();break;         case 2:practice_mode(con);break;         case 3:see();break;         case 4:score();break;         case 5:printf("期待您取得好的成绩，再见！");break;         default:printf("input error!");     }      return 0;    //要么加上这句要么int改成void }  void chuangguan_mode() {     void easy_mode(struct config con);     void difficulty_mode(struct config con);     int i;     printf("[1]简易模式");     printf("[2]困难模式");     printf("请再次输入你的选择：");     scanf("%d",&i);     switch(i)     {         case 1:easy_mode(con);break;         case 2:difficulty_mode(con);break;         default:printf("input error!");     } } void easy_mode(struct config con) {     printf("欢迎来到简易模式！");     srand((unsigned)time(0));     int a,b,c,d,i,j,p,z;     float x;     for(i=0;i<(con.topicNum);i++)     {         a=rand()%11;         b=rand()%101;         c=rand()%101;         d=rand()%101;         z=a*b+c-d;         printf("请看题：%d*%d+%d-%d=\n",a,b,c,d);         printf("请输入答案：");         scanf("%f",&x);         if(x==z)         {             printf("\t\t\t恭喜你做对了,请看下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }     }     for (j=0;j<(con.chance-1);j++)     {         printf("\t\t\t\t请再次输入: ");         //scanf("%d",&x);         scanf("%f",&x);    //上面定义的float，这儿为啥要用%d呢？         if (x==z)         {             printf("\t\t\t恭喜你做对了，正在加载下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }         else         {             FILE *fp;             if((fp=fopen("错题集(闯关模式).txt","a+"))==NULL)             {                 printf("can't open this file!\n");                 exit(1);             }             fprintf(fp,"%d=%d*%d+%d-%d\n",z,a,b,c,d);             fclose(fp);             printf("正确答案为：%d,这道题被存放在“错题集(闯关模式)中",z);         }     } } void difficulty_mode(struct config con) {     printf("欢迎来到困难模式!");     srand((unsigned)time(0));     int a,b,c,d,e,i,j,z;     float x;     for(i=0;i<(con.topicNum);i++)     {         a=rand()%11;         b=rand()%101;         c=rand()%101;         d=rand()%101;         z=a*b+c-d*2-e;    //这儿的e没有初始化哦         printf("请看题：%d*%d+%d-%d*2-%d=\n",a,b,c,d,e);         printf("请输入答案：");         scanf("%f",&x);         if(x==z)         {             printf("\t\t\t恭喜你做对了,请看下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }     }     for (j=0;j<(con.chance-1);j++)     {         printf("\t\t\t\t请再次输入: ");         //scanf("%d",&x);         scanf("%f",&x);    //相同的问题,同上         if (x==z)         {             printf("\t\t\t恭喜你做对了，正在加载下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }         else         {             printf("正确答案为：%d,这道题被存放在“错题集(闯关模式)中",z);             FILE *fp;             if((fp=fopen("错题集(闯关模式).txt","a+"))==NULL)             {                 printf("can't open this file!\n");                 exit(2);             }             //fprintf(fp,"%f=%d*%d+%d*2-%d\n", z,a,b,c,d,e);             fprintf(fp,"%d=%d*%d+%d*2-%d\n", z,a,b,c,d);   //5个%d为啥后面跟6个参数呢？             fclose(fp);         }     } } int practice_mode(struct config con) {     printf("欢迎来到练习模式");     srand((unsigned)time(0));     int a,b,c,d,e,i,j;     float x,z;     for(i=0;i<con.topicNum;i++)     {         a=rand()%11;         b=rand()%101;         c=rand()%101;         d=rand()%101;         e=rand()%10;         z=a*b+c-d/e;         printf("请看题：%d*%d+%d-%d/%d=\n",a,b,c,d,e);         printf("请输入答案：");         scanf("%f",&x);         if(x==z)         {             printf("\t\t\t恭喜你做对了，正在加载下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }     }     for (j=0;j<con.chance-1;j++)     {         printf("\t\t\t\t请输入 ");         //scanf("%d",&x);         scanf("%f",&x);   //问题同上         if (x==z)         {             printf("\t\t\t恭喜你做对了，正在加载下一题\n");             int y=rand()%4;             switch(y)             {                 case 1:printf("\t\t\t\t%s\n",award1.good);break;                 case 2:printf("\t\t\t\t%s\n",award1.well);break;                 case 3:printf("\t\t\t\t%s\n",award1.cheers);break;             }         }         else         {             FILE *fp;             if((fp=fopen("错题集(训练模式).txt","a+"))==NULL)             {                 printf("can't open this file!\n");                 exit(3);             }             fprintf(fp,"%d=%d*%d+%d-%d/%d",a,b,c,d,e);             fclose(fp);             //printf("正确答案为：%d,这道题被存放在“错题集(练习模式)中",z);             printf("正确答案为：%f,这道题被存放在“错题集(练习模式)中",z);    //注意z定义的类型         }     } } void see() {     void see1();     void see2();     int i;     printf("请选择错题集：");     printf("[1]闯关模式");     printf("[2]练习模式");     switch(i)   //i有初始化吗？     {         case 1:see1();break;         case 2:see2();break;         default:printf("input error!");     } } void see1() {     FILE *fp;     if((fp=fopen("错题集(闯关模式).txt","r+"))==NULL)     {         printf("can't open this file!\n");         exit(4);     }     fclose(fp); } void see2() {     FILE *fp;     if((fp=fopen("错题集(训练模式).txt","r+"))==NULL)     {         printf("can't open this file!\n");         exit(5);     }     fclose(fp); } void score() {     FILE *fp;     if((fp=fopen("历史成绩.txt","r+"))==NULL)     {         printf("can't open this file!\n");         exit(6);     }     fclose(fp); } 供参考～  逻辑问题没发现，倒是语法问题很多。楼主的main函数里有调用接口吗？如果不加调用函数，程序是什么也不会执行的，你虽然定义了。  基本语法问题是基础问题，所以建议楼主关注一下编译警告

user: user-0
content: 这是一个模拟中学生算数比赛的小游戏