getline
#include <iostream> #include <cstring> #include <algorithm> using namespace std; int main() { char s[100]; string S; cin.getline(s,10); S=s; cout<<s<<endl; cout<<S<<endl; getline(cin,S); strcpy(s,S.c_str()); cout<<S<<endl; cout<<s<<endl; return 0; }

浙公网安备 33010602011771号