0
点赞
收藏
分享

微信扫一扫

C++ char 转 string

陬者 2022-03-12 阅读 106

C++ char 转 string,提升速度,快速处理!

#include<iostream>
#include<cstring>

using namespace std;
const int N = 100;
char str1[N], str2[N];
string s1, s2;
int main()
{
    scanf("%s%s",str1,str2);
    s1 = str1, s2= str2;
    cout<<s1<<endl<<s2<<endl;
    //只能转为string类型处理,如果想输出sting类型,还是得用到cout,这样速度就又慢了。
    // printf("%s\n%s\n",s1,s2);
    return 0;
}
举报

相关推荐

0 条评论