10分求助!!!
查看原帖
10分求助!!!
1070491
Kmeow楼主2024/2/22 22:38
#include <bits/stdc++.h>
using namespace std;
struct score{
	string name;
	int Chinese;
	int Math;
	int English;
	int tot;
};
score sc[100];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>sc[i].name>>sc[i].Chinese>>sc[i].Math>>sc[i].English;
		sc[i].tot=sc[i].Chinese+sc[i].English+sc[i].Math; 
	}
	for(int i=1;i<n;i++)
		for(int j=1;j<n;j++)
			if(sc[j].tot<sc[j+1].tot)
				swap(sc[j],sc[j+1]);
	cout<<sc[1].name<<' '<<sc[1].Chinese<<' '<<sc[1].Math<<' '<<sc[1].English<<endl;
    return 0;
}

拜托各位

大

大

大

大

大
佬

以及

神犇犇

help一下

谢谢了

2024/2/22 22:38
加载中...