题解 | #字符串连接#

字符串连接

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

#include <iostream>
using namespace std;

int main() {
    char a[201], b[101];
    while (cin >> a >> b) { // 注意 while 处理多个 case
        int i = 0, j = 0;
        while (a[i] != '\0') ++i;
        while (b[j] != '\0') a[i++] = b[j++];
        a[i] = '\0';
        cout << a << endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务