摘要: 1.每次读入一个单词 #include<iostream> #include<string> using namespace std; int main(){ string word; int n=1; while(cin>>word){ cout<<n<<": "<<word<<endl; n++ 阅读全文
posted @ 2022-01-04 22:24 Rrrrrrover丶 阅读(66) 评论(0) 推荐(0)
摘要: 1.cin>> string s; cin>>s; 读取 且 忽略 开头 所有的 空白字符 (空格,换行符,制表符\t 即按键盘上TAB) 读取,直至再次遇到空白符,终止 2.getline() string line; getline(cin,line); 不读取换行符 读取开头的空格 若第一个字 阅读全文
posted @ 2022-01-04 22:24 Rrrrrrover丶 阅读(44) 评论(0) 推荐(0)
摘要: 1.字符 string str = “hello, world”; for(auto ch : str) { cout << ch << endl; } 2. 阅读全文
posted @ 2022-01-04 22:08 Rrrrrrover丶 阅读(66) 评论(0) 推荐(0)
摘要: Windows control+z Unix || Macos control+d 阅读全文
posted @ 2022-01-04 22:04 Rrrrrrover丶 阅读(27) 评论(0) 推荐(0)