C++如何输入含有空格字符的字符串

如题所述

第1个回答  2018-07-16
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
char str[100];
string str1;
scanf("%s", &str);
//getline(cin,str1);
//gets(str);
//cin.getline(str, 10);

cout<<str<<endl;
system("pause");
return 0;
}

本回答被网友采纳
第2个回答  2018-07-16
gets, getline, cin.get, cin.getline
相似回答