二级c上机编程答案※※a※b……题型(Two level C programming on the answer of a a B...... Questions)_第1页
二级c上机编程答案※※a※b……题型(Two level C programming on the answer of a a B...... Questions)_第2页
二级c上机编程答案※※a※b……题型(Two level C programming on the answer of a a B...... Questions)_第3页
二级c上机编程答案※※a※b……题型(Two level C programming on the answer of a a B...... Questions)_第4页
二级c上机编程答案※※a※b……题型(Two level C programming on the answer of a a B...... Questions)_第5页
已阅读5页,还剩14页未读, 继续免费阅读

下载本文档

kok电子竞技权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

kok电子竞技:文档简介

1、二级c上机编程答案ab题型(Two level C programming on the answer of a a B. Questions)4. specifies that the input string contains only letters and * numbers. Write the function fun, whose function is to delete all the * numbers in a string. When writing functions, string functions provided by the C language must

2、not be used.For example, the contents of the string are: *A*BC*DEF*G*, and the contents of the string after deletion should be: ABCDEFG.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fill in the few parentheses you have wr

3、itten in the curly braces of the function fun.reference answerVoid fun (char *a)Int, I, j = 0;For (I = 0; ai! = 0; I)If (ai! = *Aj = ai; / * if not to delete the character * left.Aj = 0; / * add the final end of string 0.12. specifies that the input string contains only letters and * numbers. Please

4、 write function fun, its function is: in addition to the leading string * number, the string will be deleted all other *. When writing functions, string functions provided by the C language must not be used.For example, the contents in the string are: *A*BC*DEF*G*, and the contents of the string sho

5、uld be: *ABCDEFG after deletion.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fill in the few parentheses you have written in the curly braces of the function fun.reference answerVoid fun (char *a)Int i = 0;Char *p = a;Wh

6、ile (*p&*p = = * )Ai = *p; I; P;While (*p)If (*p! = *Ai = *p; I;P;Ai = 0;14. specifies that the input string contains only letters and * numbers. Please write the function fun, its function is: the string tail * number all delete, front and middle of the * number is not moving.For example, the conte

7、nts in the string are: *A*BC*DEF*G*, and the contents of the string should be: *A*BC*DEF*G after deletion. When writing functions, string functions provided by the C language must not be used.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other

8、 functions. Just fill in the few parentheses you have written in the curly braces of the function fun.reference answerVoid fun (char *a)While (*a! = 0A;A; / * a is a pointer to the end of the string.While (*a = = * )A; / * a is a pointer to the last letter.* (A1) = 0; / * in the string added to the

9、end of the end of the identifier.19. specifies that the input string contains only letters and * numbers. Please write the function fun, whose function is to move the leading * numbers in the string to the tail of the string.For example, the contents in the string are: *A*BC*DEF*G*, and after moving

10、, the contents of the string should be: A*BC*DEF*G*. When writing functions, string functions provided by the C language must not be used.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fill in the few parentheses you have

11、written in the curly braces of the function fun.reference answerVoid fun (char *a)Int i = 0, n = 0;Char *p;P = a;While (*p = = / * *) to determine whether the *p is * *, and a number of statistics.N; P;While (*p) / * * will be leading the character after the transfer to a*/Ai = *p; I; P;While (n! =

12、0)Ai = *; I; n;Ai = 0;22. specifies that the input string contains only letters and * numbers.Please write the function fun, its function is: only delete characters leading and tail * number, string of letters between the * number are not deleted. The parameter n gives the length of the string, and

13、the parameter H gives the number of the leading alpha in the string. The parameter e gives the number of the tail * number in the string. When writing functions, string functions provided by the C language must not be used.For example, the contents in the string are: *A*BC*DEF*G*, and the contents o

14、f the string should be: A*BC*DEF*G after deletion.reference answerVoid, fun (char, *a, int, N, int, h, int, e)Int, I, j = 0;For (I = h; Ine; / * I) between the first letter and the last character does not delete.Aj = ai;Aj = 0; / * in the string plus end mark * /25. assume that the input string cont

15、ains only letters and * numbers. Please write function fun, its function is: in addition to the tail * number, will be in the characters of the other * number all deleted. The parameter P has been pointing to the last letter in the string. When writing functions, string functions provided by the C l

16、anguage must not be used.For example, the content in the string is *A*BC*DEF*G*, and the content in the string should be ABCDEFG* after deletion.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fill in the few parentheses yo

17、u have written in the curly braces of the function fun.reference answerVoid fun (char, *a, char, *p)Char *t = a;(for; t = p; T)If (*t! = * (a + +) = *t; / * p *, not all previous characters retained.For (*t)! = 0; T)* (a + +) = *t; / * P after all * * / preserved*a = 0; / * in the end with the end o

18、f the string string ID *29. specifies that the input string contains only letters and * numbers. Write function fun, its function is: the preamble of the string * delete all, the middle and tail of the * number is not deleted.For example, the contents of the string are: *A*BC*DEF*G*, and the content

19、s of the string after deletion should be: A*BC*DEF*G*. When writing functions, string functions provided by the C language must not be used.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fill in the few parentheses you hav

20、e written in the curly braces of the function fun.reference answerVoid fun (char *a)Char *p = a;While (*p = = * )P + + p; / * pointer to the string the first letter.For (*p)! = 0; P, A)*a = *p; / * from the beginning of the first letter, then the character string pointer into a refers to the.*a = 0;

21、 / * in the end with the end of the string string ID *We offer another solution here.#includeVoid fun (char *a)char *p = a;While (*p = = *) P;Strcpy (a, P);43. specifies that the input string contains only letters and * numbers. Write a function fun, its function is: in addition to leading and trail

22、ing string * number, will on other * delete all. The parameter h has been pointing to the first letter in the string, and the parameter p points to the last letter in the string. When writing functions, string functions provided by the C language must not be used.For example, if the content in the s

23、tring is *A*BC*DEF*G*, then the contents of the string should be: *ABCDEFG*. When writing functions, string functions provided by the C language must not be used.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, or any other functions,Fill in the few stat

24、ements you wrote in the curly braces of function fun only.reference answerVoid fun (char, *a, char, *h, char, *p)Int i = 0;Char *q = a;While (qh) / * * / * number of leading endAi = *q; Q; I;While (qn) / * if K is greater than N, then the P front retains n an asterisk following characters sequential

25、ly stored in the array a.while (*p)ai = * (Pkn);I;P;Ai = 0; / * in the string plus the last bit.52. specifies that the input string contains only letters and * numbers. Please write the function fun, its function is: the string in the tail of the * number is not more than N, if more than N, then rem

26、ove the extra *; if less than or equal to N, then do not do any operation, and in front of the middle of the string does not delete *.For example, a string of content: *A*BC*DEF*G*, if the n value is 4, after removing the contents of a string should be: *A*BC*DEF*G*; if the value of n is 7, then the

27、 contents of a string is: *A*BC*DEF*G*. The value of n is entered in the main function. When writing functions, string functions provided by the C language must not be used.Note: part of the source is in the file PROG1.C.Do not change any of the main functions, main, and any other functions. Just fi

28、ll in the few parentheses you have written in the curly braces of the function fun.reference answerVoid fun (char, *a, int, n)Int i = 0, k = 0;Char, *p, *t;P = t = a;While (*t)T;T;While (*t = = * )k; T;If (kn)while (*p&pn) / * if K is greater than N, then the P front retains n an asterisk following characters sequentially stored in the array a.while (*p)ai = * (Pkn);I;P;Ai = 0; / * string plus end flag.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论