2089 实验11字符串:连接

Time Limit : 2000/1000 MS(Java/Others) | Memory Limit : 131072/65536 KB(Java/Others)

Submits : 10 | Solved : 8

Description

试编写函数将两个字符串连接起来,不能用strcat函数。

Input

所有输入在合法范围内,输入只有1组测试数据。一组数据包含两个字符串,字符串间用空格隔开,每个字符串长度<=19。

Output

输出连接后的新字符串,输出后换行。

Sample Input

1ere1 dfgghh

Sample Output

1ere1dfgghh

HINT

#include < stdio.h >
#include < string.h >

int main(){
  char a[40]="",b[20]="";
  char* pa=a,*pb=b;
  scanf("%s%s",a,b);
  while (*pa!='\0') pa++;
  while (*pb!='\0') {*pa=*pb;pa++;pb++;}
  *pa='\0';
  printf("%s\n",a);
  return 0;
}

Source


[ Top ] | [ Submit ]