可以帮蒟蒻看看结构体string为什么读不进构造函数吗QAQ
查看原帖
可以帮蒟蒻看看结构体string为什么读不进构造函数吗QAQ
393190
aldol_reaction楼主2020/10/26 15:14
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<set>
using namespace std;

struct stu {
	char id;
	int old, score;
	stu(string _id = "", int _old = 0, int _score = 0) {
		old = _old, score = _score;
	}
};

void upp(stu &s) {
	s.old++;
	s.score *= 1.2;
	if(s.score > 600) s.score = 600;
}

int n;
string id;
int old, score;

int main() {
	cin>> n;
	for(int i = 0; i < n; i++) {
		cin>> id>> old>> score;
		stu s = stu(id, old, score);//为什么string id传不进stu s中?? 
		upp(s);
		cout<< s.id<< " "<< s.old<< " "<< s.score<< endl;
	}
	return 0;
}














2020/10/26 15:14
加载中...