#include <iostream>
#include <string>
//#include <cstdlib>
using namespace std;
int main() {
string a;
getline(cin, a);
char name[20];
cin.getline(name, 10);
cout << name<<endl<<a<<endl;
return 0;
}
一一适配的,这两种用getline给字符串赋值的形式不能互通。
我的编译器不允许使用char *name;代替char name[20];