标签:stream 北京大学 cin har get ios pre int ace
基本思想:
无;
关键点:
无;
#include<iostream> #include<string> #include<vector> #include<sstream> using namespace std; vector<string>vec; int main() { string s; string a,b; while (getline(cin,s)) { vec.resize(0); cin >> a >> b; stringstream fin(s); string c; while (fin >> c) { if (a == c) { vec.push_back(b); } else { vec.push_back(c); } } for (int i = 0; i < vec.size(); i++) { if (i == 0) cout << vec[i]; else cout << " " << vec[i]; } cout << endl; getchar(); } }
标签:stream 北京大学 cin har get ios pre int ace
原文地址:https://www.cnblogs.com/songlinxuan/p/12459808.html