getline函数如何实现从输入流中读取一整行,直到遇到换行符或文件结束?
- 内容介绍
- 文章标签
- 相关推荐
本文共计77个文字,预计阅读时间需要1分钟。
当然可以,请您提供需要改写的原文,我会帮您进行修改。
#include <bits/stdc++.h> #include <string> using namespace std; string s; int main() { getline(cin,s); cout<<s<<endl; /* fsw sf fsw sf */ cin>>s cout<<s<<endl; fsw sf fsw return 0; }
本文共计77个文字,预计阅读时间需要1分钟。
当然可以,请您提供需要改写的原文,我会帮您进行修改。
#include <bits/stdc++.h> #include <string> using namespace std; string s; int main() { getline(cin,s); cout<<s<<endl; /* fsw sf fsw sf */ cin>>s cout<<s<<endl; fsw sf fsw return 0; }

