Cheng9857 2021-09-19 17:10 采纳率: 0%
浏览 9

error C2143: syntax error : missing ';' before 'type'错误提示代码如下

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int N1,N2;
int n=0;
int y,n;         //此处错误
struct course
{   int num1;        //课程编号
    char name1[20];  
    char major[20];
    char type[20];
    int credit;
    int period;
    char teacher[20];
    int people;                   //选此门课程的人数
    struct course *next;      };  //结构体指针
struct student
{   int num2;
    char name2[20];
    int nelenum[50];              //所选课程编号
    int nelen;                    //所选课程学分和
    struct student * next;   };
struct course * head1;
struct student * head2;
void zhang()                 //从键盘录入课程信息
{
   struct course *p1,*p2;
   N1=0;
   p1=p2=(struct course *)malloc(sizeof(struct course));
   int y,n;
   if(n==0)
   do
  {
   printf("--------------------\n");
   printf("请输入课程编号:");
   scanf("%d",&p1->num1);
   printf("请输入课程名称:");
   scanf("%s",p1->name1);
   printf("请输入主修:");
   scanf("%s",p1->major);
   printf("请输入课程性质:");
   scanf("%s",p1->type);
   printf("请输入学分:");
   scanf("%d",&p1->credit);
   printf("请输入课时:");
   scanf("%d",&p1->period);
   printf("请输入教师名称:");
   scanf("%s",p1->teacher); 
   n++;
   p1++;
   printf("\n1.继续输入.\n0.输入完毕.\n");
   printf("请选择:");
   scanf("%d",&y);
  }

  • 写回答

1条回答 默认 最新

  • dmm128073411 2023-01-02 18:50
    关注

    你已经定义了一个n,怎么又定义一个

    img

    评论

报告相同问题?

问题事件

  • 创建了问题 9月19日

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器