dalao看一下,Compile Error

P5740 【深基7.例9】最厉害的学生

AC_llq @ 2021-10-04 14:47:04

#include<bits/stdc++.h>
using namespace std;
struct stu{
    string name;
    int eng,ma,chi,sum;
};
int s,max;
stu a[1001];
bool a1[1001];
int main(){
    cin>>s;
    for(int q=0;q<s;q++)
    {
        cin>>a[q].name>>[q]a.chi>>a[q].ma>>a[q].eng;
        sum=a[q].chi+a[q].ma+a[q].eng;
    }
    for(int q=0;q<=s;q+=2)
    {
        if(a[q].sum<a[q+1].sum)
            swap(a[q],a[q+1]);
    }
    max=a[1].sum;
    int z=0;
    while(sum==max)
    {
        cout<<a[z].name<<" "<<a[z].chi<<" "<<a[z].ma<<" "<<a[z].eng;
        z++;
    }
    return 0;
}

by Suzt_ilymtics @ 2021-10-04 14:49:07

@I学生党乐岍I [q]a.chi 这都看不出来?


by dxy2020 @ 2021-10-04 14:49:24

 cin>>a[q].name>>[q]a.chi>>a[q].ma>>a[q].eng;

by 张天泽20091225 @ 2021-10-04 14:49:54

cin>>a[q].name>[q]a.chi>>a[q].ma>>a[q].eng;

cin>>a[q].name>a[q].chi>>a[q].ma>>a[q].eng;


by Suzt_ilymtics @ 2021-10-04 14:52:12

@I学生党乐岍I 建议您编译的时候看一下错误信息。


by AC_llq @ 2021-10-04 14:53:32

@Suzt_ilymtics ok


by AC_llq @ 2021-10-04 14:54:07

@Suzt_ilymtics wssb


by AC_llq @ 2021-10-04 14:56:15

还是错。。。


by 张天泽20091225 @ 2021-10-04 14:59:01

@I学生党乐岍I

看下私信

谢谢


by Frost2008 @ 2021-10-04 15:00:21

以后这种编译bug不要发到讨论区,因为大部分自己都能解决


|