c++不知哪错了
查看原帖
c++不知哪错了
759152
yinbe楼主2022/12/28 14:39
#include<iostream>
using namespace std;
struct student
{
	string name;
	int score;
};
int main()
{
	int n,max=0,t=1;
	scanf("%d",&n);
	student stu[n+1];
	for(int i=1;i<=n;i++)
	{
		scanf("%d%s",stu[i].score,stu[i].name.c_str());
		if(stu[i].score>max)
		{
			max=stu[i].score;
			t=i;
		}
	}
	printf("%s",stu[t].name.c_str());
	return 0;
}
2022/12/28 14:39
加载中...