读取一行多个字符串的方法
while(getline(cin,line))
{
string x;
flag1++;
flag2=0;
stringstream ss(line);
while(ss>>x)
{
cout<<x<<' ';
flag2++;
t[flag1][flag2]=x;
}
cout<<endl;
}
撒花~
while(getline(cin,line))
{
string x;
flag1++;
flag2=0;
stringstream ss(line);
while(ss>>x)
{
cout<<x<<' ';
flag2++;
t[flag1][flag2]=x;
}
cout<<endl;
}
撒花~
相关推荐