带空格的字符串输入处理

1.若输入为string类型,可用getline(),注意必须带string头文件ios #include<iostream> #include<string> using namespace std; int main() { string s; while (getline(cin,s)) cout << s << endl; return 0; } 2.若输入为char类型,可
相关文章
相关标签/搜索