社区讨论

求救,为什么我按样例输入n=4,但主函数for循环输入3行就输出结果了

P5742【深基7.例11】评等级参与者 2已保存回复 2

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
2 条
当前快照
1 份
快照标识符
@lo32a27j
此快照首次捕获于
2023/10/23 23:37
2 年前
此快照最后确认于
2023/10/23 23:37
2 年前
查看原帖
C
#include<bits/stdc++.h>
using namespace std;
struct stu{
	int sno;
	int score1;
	int score2;
	int score3;
	int sum(){
		int a=score1;
		int b=score2;
		return a+b;
	};
};
void judge(stu a){
	if(a.sum()>140&&a.score3>=800)
	cout<<"Excellent"<<endl;
	else
	cout<<"Not excellent"<<endl;
}
int main()
{
	int n;
	cin>>n;
	stu a[n];
	for(int i=0;i<n;i++){
		cin>>a[i].score1>>a[i].score2;
		a[i].score3=a[i].score1*3+a[i].score2*7;
	}
	for(int j=0;j<n;j++){
		judge(a[j]);
	}
	return 0;
	}

回复

2 条回复,欢迎继续交流。

正在加载回复...