几道C语言题求助。
1.C语言,输入俩个字符串,让第二个字符串连接在第一个字符串后面。2.输入三个字符串,找到最大的,并输出。
程序代码:#include<stdio.h>
#include<string.h>
#define MAXSIZE 100
int length(char s[]) //求长度
{
int i = 0;
while(s[i] != '\0')
i++;
return i;
}int concat(char s[],char t[]) //连接子串
{
int m,n,i;
m = length(s);
n = length(t);
if(m+n >= MAXSIZE)
return 0;
for(i = 0;i < n;i++)
s[m+i] = t[i];
s[m+i] = '\0';
return 1;
}
void main()
{
int n,i,l;
char s[MAXSIZE],t[MAXSIZE];
printf("请输入字符串s:");
scanf("%s",s);
printf("请输入字符串t:");
scanf("%s",t);
concat(s,t);
printf("新的字符串为:%s\n",s);
}第一题

