- 1、本文档共21页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
二级改错题答案(国外英文资料)
二级改错题答案(国外英文资料)
Question 1
A given program MODI1. C function is the function of fun: each character in the string s, followed by repeated once, to form a new string in t, t, in order of the original characters of a string of characters.
For example, the string in s is ABAABBCCDDEE.
The string in t is AABBCCDDEE.
Please correct the error in the function fun so that it can get the correct result. Note: do not change the main function, do not add line or delete line, also do not change the structure of the program!
Modi1. C
# include
# include
# include
To find out
Void fun (char s, char t)/reference: void fun (char * s, char * t) /
{int I, sl;
Sl = strlen (s);
For (I = 0; I
[2].
T [2 * I + 1] = s [I].
}
To find out
T [2 * sl] = 0; / the answer is: t [2 * sl] = \ 0; /
}
The main ()
{char s [100], t [100];
CLRSCR ();
Printf ( \ nPlease enter string s: ); Scanf ( % s , s);
Fun (s, t);
Printf ( The result is: % s \ n , t);
}
Second question
A given program MODI1. C function is the function of fun: each character in the string s, followed by repeated once, in a new series of t, t in the character according to the original string in reverse order.
For example, when the string in s is ABCDE,
The string in t is EEDDCCBBAA.
Please correct the error in the function fun so that it can get the correct result. Note: do not change the main function, do not add line or delete line, also do not change the structure of the program!
Modi1. C
# include
# include
# include
Void fun (char * s, char * t)
{int I, sl;
Sl = strlen (s);
To find out
I = 1
{t].
T [2 * I + 1] = s [sl-i-1].
}
To find out
T [2 * sl] = 0 /; / the answer is: t [2 * sl] = \ 0; /
}
The main ()
{char s [100], t [100];
CLRSCR ();
Printf ( \ nPlease enter string s: ); Scanf ( % s , s);
Fun (s, t);
Printf ( The result is: % s \ n , t);
}
The third question
A given program MODI1. C function is the function of fun: will the subscript for the even position in the string s characters, followed by repeated once, in a new seri
文档评论(0)