帶空格的字符串輸入處理

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類型,可
相關文章
相關標籤/搜索