C++一行字符串處理

有時候編程須要處理一行字符串,包括空格鏈接起來的一行。直接用cin的話讀到空格就會中止。html 實用的方法是使用getline函數配個stringstream流操做,簡易代碼以下。ios #include <iostream> #include <sstream> #include <string> using namespace std; int main() { string str;
相關文章
相關標籤/搜索