1.
#include <string>
string s;
getline(cin,s);
2.
#include <cstring>
#include <stdio.h>
char a[1024];
gets(a);
int len = strlen(a);//得到数组的实际长度
//!!!!!!!!!!!!!!注:cin和getline不能连着用,中间需要加一个cin.ignore;
标签:2023.8,.#,cin,空格,89,include,getline From: https://www.cnblogs.com/muzhaodi/p/17617847.html