用户:
happy_chicken查看:0 回复:0 评论:0 创建时间:2022-05-14T11:27:09
这串代码出问题了,输入不行,请大神帮新手我看看
#include <cstdio>
using namespace std;
int main() {
int N, Final_average_score[100] = {}, Class_evaluation_results[100] = {};
char Is_it_a_student_cadre[100] = {}, Are_you_a_student_from_a_western_province[100] = {}, Student_name[100] = {};
short Number_of_papers_published[100] = {};
scanf("%d", &N);
for (int i = 1; i <= N; i++)
scanf("%d%d%d%c%c%d", &Student_name[i - 1], &Final_average_score[i - 1], &Class_evaluation_results[i - 1],
&Is_it_a_student_cadre, &Are_you_a_student_from_a_western_province[i - 1], Number_of_papers_published[i - 1]);
short Academician_scholarship_judgment[100] = {}, May_fourth_scholarship_judgment[100] = {},
Outstanding_achievement_award_judgment[100] = {}, West_scholarship_judgment[100] = {}, Class_Contribution_Award[100] = {};
//Judge whether a student number has won the scholarship. Yes: number = 1, No: number = 0.
for (int i = 1; i <= N; i++) {
if (Final_average_score[i - 1] > 80 && Number_of_papers_published[i - 1] >= 1)
Academician_scholarship_judgment[i - 1] = 1;
if (Final_average_score[i - 1] > 85 && Class_evaluation_results[i - 1] >= 80)
May_fourth_scholarship_judgment[i - 1] = 1;
if (Final_average_score[i - 1] > 90)
Outstanding_achievement_award_judgment[i - 1] = 1;
if (Final_average_score[i - 1] > 85 && Are_you_a_student_from_a_western_province[i - 1] == 'Y')
West_scholarship_judgment[i - 1] = 1;
if (Final_average_score[i - 1] > 80 && Is_it_a_student_cadre[i - 1] == 'Y')
Class_Contribution_Award[i - 1] = 1;
}
int Total_Scholarships[100] = {}, Total_Scholarships_count, Maximum = -1;
//Use bubble sort to calculate who won the most scholarships, so you need to create variables needed for bubble sort.
for (int i = 1; i <= N; i++) { //Calculate the total number of scholarships received by each person.
Total_Scholarships_count = 0;
if (Academician_scholarship_judgment[i - 1] == 1)
Total_Scholarships_count += 8000;
if (May_fourth_scholarship_judgment[i - 1] == 1)
Total_Scholarships_count += 4000;
if (Outstanding_achievement_award_judgment[i - 1] == 1)
Total_Scholarships_count += 2000;
if (West_scholarship_judgment[i - 1] == 1)
Total_Scholarships_count += 1000;
if (Class_Contribution_Award[i - 1] == 1)
Total_Scholarships_count += 850;
Total_Scholarships[i - 1] = Total_Scholarships_count;
}//After calculating the total number of scholarships for each person, it is bubble sort.
for (int i = 1; i <= N; i++) {
if (Total_Scholarships[i - 1] > Maximum)
Maximum = Total_Scholarships[i - 1];
}//This is the easiest way to maximize bubble sorting.
//for(int i=1;i<=)
}