正在加载图片...
/*****水** found*****/ while(=!=*g) /******* found**冰***/ Hif (p<*g) c[k]=q c[k]=*p f(*q)q++ main O Ichar a[10]=aBCDeFgh", b[10]="ABcd" c[80]=T'\0] fun(a, b, c) printf( the string a: ) puts(a) printf( The string b: ) puts(b) printf(" The result: ) puts(c) 3、下列给定程序中,函数fun的功能是:依次取出字符串中所有数字字符,形成新的字符 串,并取代原字符串。 请改正程序中的错误,使程序能得出正确的结果。 注意,不要改多main函数,不得增行或删行,也不得更改程序的结构! 试题程序 #include <stdio. h> #include void fun (char *s) t int i, j for(i=0,j=0;s[i]!=\0’;i++) /*水***水** found***率水*/ if(s[i]>='0&&s[i]<='9 sLj]=s[i] /*****水* found******/ s[j]="0 (char item[80] printf("\nEnter a string: ) gets (item) printf (" \n\nThe string is \%s\n", item) fun (item) printf( \n\nThe string of changing is \%s\n, item) 4、下列给定程序中,函数fun的功能是:分别铜级字符串中大写字母和小写字母的个数 唯C动力(htp:/www.clearner.net)版权所有第 4 页 共 75 页 唯 C 动力(http://www.clearner.net)版权所有 /**********found***********/ while(*p!=*q) /**********found***********/ {if (*p<*q) c[k]=*q; else c[k]=*p; if (*p) p++; if (*q) q++; k++; } } main() {char a[10]="aBCDeFgh",b[10]="ABcd",c[80]={'\0'}; fun(a,b,c); printf("The string a:"); puts(a); printf("The string b:"); puts (b); printf("The result:"); puts(c); } 3、下列给定程序中,函数 fun 的功能是:依次取出字符串中所有数字字符,形成新的字符 串,并取代原字符串。 请改正程序中的错误,使程序能得出正确的结果。 注意,不要改多 main 函数,不得增行或删行,也不得更改程序的结构! 试题程序 #include <stdio.h> #include <conio.h> void fun (char *s) { int i,j; for (i=0,j=0;s[i]!='\0';i++) /**********found***********/ if (s[i]>='0' && s[i]<='9') s[j]=s[i]; /**********found***********/ s[j]="\0"; } main() {char item[80]; clrscr(); printf("\nEnter a string:");gets(item); printf("\n\nThe string is :\%s\n",item); fun (item); printf("\n\nThe string of changing is :\%s\n",item); } 4、下列给定程序中,函数 fun 的功能是:分别铜级字符串中大写字母和小写字母的个数
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有