echo_chenchen 2022-10-16 01:36 采纳率: 80.2%
浏览 14
已结题

结构体为啥这样语法报错



#include<stdio.h>
#include<math.h>
int judge(int a,int b,int distance);
struct score
{
    int numble;
    int ChineseScore;
    int MathScore;
    int EnglishScore;
    int sum
};
int main()
{
  int N=0;
  int count=0;
  scanf("%d",&N);
  struct score[1001];
  for(int i=0;i<N;i++)
  {
      scanf("%d%d%d",&score.ChineseScore,
      &score.MathScore,&EnglishScore);
      sum=score.ChineseScore+score.MathScore+EnglishScore;
  }
  for(int i=0;i<N;i++)
  {
      for(int j=i;j<N;j++)
      {
        int flag=1;
        flag=judge(score[i].ChineseScore,score[j].ChineseScore,5);
        flag=judge(score[i].MathScore,score[j].MathScore,5);
        flag=judge(score[i].EnglishScore,score[j].EnglishScore,5);
        flag=judge(score[i].sum,score[j].sum,10);
        if(flag)
           count++;
      }
  }
}
int judge(int a,int b,int distance)
{
    int flag=1;
    if(abs(a-b)>distance)
       flag=0;
    return flag;
}

img

展开全部

  • 写回答

2条回答 默认 最新

  • 浪客 2022-10-16 01:49
    关注

    23,24行EnglishScore前缺少&score.
    输入变量也不对。&score[i].ChineseScore

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

问题事件

  • 系统已结题 10月23日
  • 已采纳回答 10月16日
  • 创建了问题 10月16日
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部