其他分享
首页 > 其他分享> > getline

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

 

标签:std,10,main,string,include,getline
来源: https://www.cnblogs.com/sherkevin/p/16076299.html