?/p>
1
?/p>
【程序改错?/p>
功能:先将在字符?/p>
s
中的字符按逆序存放?/p>
t
串中,然后把
s
中的
字符按正序连接到
t
串的后面?/p>
例如:当
s
中的字符串为?/p>
?/p>
ABCDE
”时,则
t
中的字符串应为:
?/p>
EDCBAABCDE
?/p>
?/p>
------------------------------------------------------*/
#include <conio.h>
#include <stdio.h>
#include <string.h>
void fun (char *s, char *t)
{
/**********FOUND**********/
int i;
sl = strlen(s);
for (i=0; i<sl; i++)
/**********FOUND**********/
t[i] = s[sl-i];
for (i=0; i<sl; i++)
t[sl+i] = s[i];
/**********FOUND**********/
t[2*sl] = "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);
}
答案?/p>
1). int i,sl;
2). t[i] = s[sl-i-1];
3). t[2*sl] = '\0';
?/p>
t[2*sl] = 0;
?/p>
2
?/p>
【程序改错?/p>
功能:求出以下分数序列的?/p>
n
项之和。和值通过函数值返?/p>
main
函数?/p>
2/1+3/2+5/3+8/5+13/8+21/13
…?/p>
例如:若
n = 5
,则应输出:
8.391667
?/p>
------------------------------------------------------*/
#include <conio.h>
#include <stdio.h>
/**********FOUND**********/
fun ( int n )