#include <iostream>
#include<vector>
#include <string>
#include <algorithm>
#include<sstream>
using namespace std;
int StoI(const string &s)
{
istringstream is(s);
int tmp = 0;
is >> tmp;
return tmp;
}
string ItoS(const int num)
{
ostringstream os;
os << num;
string tmp = os.str();
return tmp;
}
//分隔字符
void GetString(vector<string> &data, string s)
{
istringstream is(s);
string tmp="";
while (is >> tmp)
data.push_back(tmp);
}
int main()
{
string s;
vector<string> data;
while (getline(cin, s))
{
GetString(data, s);
}
for (auto c : data)
{
cout << c << endl;
}
system("pause");
}
字符與數字之間的轉換
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.