• SDUT 2124 串结构练习——字符串连接


     

    串结构练习——字符串连接

    Time Limit: 1000 ms Memory Limit: 65536 KiB

    Problem Description

     给定两个字符串string1和string2,将字符串string2连接在string1的后面,并将连接后的字符串输出。
    连接后字符串长度不超过110。 

    Input

     输入包含多组数据,每组测试数据包含两行,第一行代表string1,第二行代表string2。
     

    Output

     对于每组输入数据,对应输出连接后的字符串,每组输出占一行。
     

    Sample Input

    123
    654
    abs
    sfg

    Sample Output

    123654
    abssfg

    本题需要用到一个特殊的函数,strcat函数,用于字符串之间的连接,所以这个题代码非常短。

    代码实现如下(g++):
    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main()
    {
        char a[110];
        char b[110];
        while(gets(a)!=NULL)
        {
            gets(b);
            strcat(a,b);
            puts(a);
        }
        return 0;
    }
    
    
    /***************************************************
    Result: Accepted
    Take time: 0ms
    Take Memory: 180KB
    ****************************************************/
  • 相关阅读:
    内存检测与优化
    iOS逆向工程(1)
    UIBezierPath 概述
    万能弹窗,点击区域外消失
    逆向传值
    蓝牙开发
    pod
    github
    iOS语音
    图像去噪——分割后处理
  • 原文地址:https://www.cnblogs.com/jkxsz2333/p/9492062.html
Copyright © 2020-2023  润新知