被水题制裁
查看原帖
被水题制裁
555584
weiming3楼主2023/3/2 09:02
#include <iostream>
using namespace std;
class student {
	private:
		string name;
		int age;
		int score ;
	public:
		void train() {
			if (score * 1.2 >= 600) {
				score = 600;
			} else {
				score=(score/5)*6;
				
				age += 1;
			}
		}
		friend istream& operator >>(istream&is, student&s) {
			is >> s.name >> s.age >> s.score;
			return is;
		}
		friend ostream& operator<<(ostream& os, student& s) {
			os << s.name << " " << s.age << " " << s.score << endl;
			return os;
		}
};
int main() {
	int n;
	cin >> n;
	student a[n + 2];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		a[i].train();
		cout << a[i];
	}
	return 0;
}
2023/3/2 09:02
加载中...