填空题
请补充fun函数,该函数的功能是:先将在字符串s中的字符按逆序存放到t串中,然后把s中的字符按正序连接到t串的后面。
例如:s中的字符串为ABCDE时,则t中的字符串应为EDCBAABCDE。
请勿改动主函数main和其他函数中的任何内容,仅在fun函数的横线上填入所编写的若干表达式或语句。
#include
#include
#include
void fun(char *s, char *t)
{
int s1, i;
s1 = strlen(s);
for (i=0; i
t[i] = s[___1___];
for (i=0; i
t[s1+i] = s[i];
t[___2___] = '\0';
}
main()
{
char s[100], t[100];
printf("\nPlease enter string s:");
scanf("%s", s);
fun(s, t);
printf("The result is: %s\n", t);
}
参考答案:1:s1-i-1或s1-1-i
2:2*s1或s1*2