1 solutions
-
0
C :
#include<stdio.h> #include<string.h> char c[41]; void mystrcat(char a[],char b[]) { int i,j=0,k; for(i=0;i<strlen(a);i++) c[i]=a[i]; k=i; for(;i<(k+strlen(b));i++) c[i]=b[j++]; c[i]='\0'; } int main() { char a[21],b[21]; while(scanf("%s",a)!=EOF) { scanf("%s",b); mystrcat(a,b); puts(c); } return 0; }C++ :
#include<stdio.h> #include<string.h> void MyStrcat(char s1[],char s2[]) { int i,j; for(i=strlen(s1),j=0;s2[j];i++,j++) s1[i]=s2[j]; s1[i]='\0'; } int main() { char s1[50],s2[21]; while(scanf("%s",s1)!=EOF) { scanf("%s",s2); MyStrcat(s1,s2); puts(s1); } return 0; }
- 1
Information
- ID
- 19731
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By