C++ 小程序
2016-01-31 16:57
381 查看
#include <cstdio> #include <iostream> using namespace std; int main(){ freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); string str; //while(getline(cin, str)){ while(cin >> str){ //这个遇见空格会断句 cout << "* " + str << endl; //写Markdown时将每行前面加上一个星号 int pos = str.find('+'); //写Markdown时将每行的加号前后加上空格 cout << str.substr(0, pos) << " + " << str.substr(pos + 1, str.size()) << endl; } return 0; }