二級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頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

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 remove 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

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論