第1个回答 2009-06-19
语句写对了吗?
程序例子。你试试。一次回车就可以了。
#include <iostream>
using namespace std;
void main()
{
char s[256];
cout << "Enter string with spaces: ";
cin.getline (s,256);
cout << s << endl;
}本回答被提问者采纳
第2个回答 2009-06-19
读到一个回车就结束输入? 那就getline足够了啊,为什么需要两次回车?你是怎么用的啊
第3个回答 2020-05-25
语句写对了吗?
程序例子。你试试。一次回车就可以了。
#include
using
namespace
std;
void
main()
{
char
s[256];
cout
<<
"Enter
string
with
spaces:
";
cin.getline
(s,256);
cout
<<
s
<<
endl;
}
第4个回答 2009-06-19
用c的gets,fgets都很好啊。
第5个回答 2009-06-19
while(cin>>s != 13)