#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iostream>
#include <string>
using namespace std;
string s1[10],s2[10];
int main ()
{
int kase=0;
while(getline(cin,s2[kase]),s2[kase]!="***")
{
string word;
stringstream ss(s2[kase]);
while(ss >> word)
{
s1[kase]=word;
kase++;
}
}
cout <<s1[1];
}
利用string stream来分割getline中的单词
最新推荐文章于 2024-04-11 15:50:23 发布