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;
}

 

posted @ 2022-03-30 11:49  兮何其  阅读(90)  评论(0)    收藏  举报