zoukankan      html  css  js  c++  java
  • 串结构练习——字符串连接(SDUT 2124)

    Problem Description

     给定两个字符串string1和string2,将字符串string2连接在string1的后面,并将连接后的字符串输出。

    连接后字符串长度不超过110。 


    Input

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


    Output

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


    Sample Input

    123
    654
    abs
    sfg                                                          

    Sample Output
    123654

    abssfg

    解析:可以用函数或者直接输出或者用教材上的orz。

    Test1:

    #include <stdio.h>
    char s1[120];
    char s2[120];
    int main()
    {
        while(~scanf("%s %s",s1, s2))
        {
            printf("%s%s
    ",s1,s2);
        }
        return 0;
    }
    

    Test2:

    #include <stdio.h>
    #include <string.h>
    char s1[120];
    char s2[120];
    int main()
    {
        while(~scanf("%s %s",s1, s2))
        {
            printf("%s
    ",strcat(s1,s2));
        }
        return 0;
    }
    
  • 相关阅读:
    Windows 7 SP1无人值守自动应答文件制作
    Ubuntu GNOME单击任务栏图标最小化设置
    NOIP2017题解
    NOIP2017游记
    大模拟1.0
    奇袭
    礼物
    找硬币
    Fiolki
    SQLserver Delete from where 与Oracle delete from where 的差异
  • 原文地址:https://www.cnblogs.com/lcchy/p/10139636.html
Copyright © 2011-2022 走看看