题解 | 字符串连接

字符串连接

https://www.nowcoder.com/practice/40d83e5509b04d20825ae68fe35e9ca8

#include <iostream>
using namespace std;

int main() {
    char s1[101]={0},s2[101]={0};
    while (cin>>s1) { // 注意 while 处理多个 case
    cin.ignore();
    cin>>s2;
    char s3[202]={0};
    int j=0;
    for(int i=0;s1[i]!=0;i++,j++)s3[j]=s1[i];
    for(int i=0;s2[i]!=0;i++,j++)s3[j]=s2[i];
    for(j=0;s3[j]!=0;j++)cout<<s3[j];
    cout<<endl;
    
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

04-14 20:10
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务