我不能理解,是哪边出问题了
查看原帖
我不能理解,是哪边出问题了
1229013
Mr_LiuXinan楼主2024/4/3 23:08

如题所示,我不知道哪边有问题,还请路过的大佬帮忙找找问题。 代码如下:(30分)

#include <iostream>
using namespace std;

int n, avg_s, p_s, esy, tmp_m, maxx, sum;
string name, m_name;
char is_g, is_w;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    
    cin >> n;
    while (n--) {
        tmp_m = 0;
        cin >> name >> avg_s >> p_s >> is_g >> is_w >> esy;
        (avg_s > 80 && esy) ? tmp_m += 8000 : 0;
        (avg_s > 85 && p_s > 80) ? tmp_m += 4000 : 0;
        (avg_s > 90) ? tmp_m += 2000 : 0;
        (avg_s > 85 && is_w == 'Y') ? tmp_m += 1000 : 0;
        (avg_s > 80 && is_g == 'Y') ? tmp_m += 850 : 0;
        tmp_m > maxx ? m_name = name, maxx = tmp_m : 0;
        sum += tmp_m;
    }
    cout << m_name << "\n" << maxx << "\n" << sum;
    return 0;
}
2024/4/3 23:08
加载中...