为什么结果是这样的,按着我的代码该怎么改,哪里有错
#include<iostream>
using namespace std;
struct stu
{
int xh;
char name[20];
int c[3];
};
struct stu d[100];
int main()
{
int n,i,j;
cin>>n;
for(i=0;i<n;i++)
{
cin>>d[i].xh>>d[i].name;
for(j=0;j<3;j++)
{
cin>>d[i].c[j];
}
}
int t=0,e=0;
for(i=1;i<+n;i++)
{
int sum=0;
for(j=0;j<3;j++)
{
sum=d[i].c[j]+sum;
}
if(sum>t)
{
t=sum;
e++;
}
}
for(i=0;i<n;i++)
{
if(i==e)
{
cout<<d[i].xh<<" "<<d[i].name<<" ";
for(j=0;j<3;j++)
{
cout<<d[i].c[j]<<" ";
}
}
}
return 0;
}