问答题
【参考答案】
double fun (int w[][N])
{
int i,j,k=0;
dou......
(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列给定的程序中,函数fun()的功能是:判断字符ch是否与str所指字符串中的某个字符相同;若相同,则什么也不做,若相同,则将其插在申的最后。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <conio.h> #include <stdio.h> #include <string.h> *************found************** void fun (char str,char ch) while (*str &&*str !=ch) str++; *************found************** if(*str==ch) str[0]=ch; *************found************** str[1]=’0’; main() char s[81],c; clrscr(); printf( nPlease enter a strzng : ); gets(s); printf( n Please enter the character to search : ); c=getchar(); fun(s,c); printf( nThe result is %s n ,s);
点击查看答案&解析
填空题
请补充函数fun(),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:abcba。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #include<string.h> #include<stdio.h> char *fun(char*str) char *p1,*p2; int i, t=0; p1=str;p2=str+strlen(str)-1; for (i=0; 【1】 ;i++) if( 【2】 ) t=1; break; if ( 【3】 ) return( yes! ); else return( no! ); main() char str[50]; printf( Input; ); scanf( %s ,str); printf( %s n ,fun(str));
点击查看答案&解析
相关试题
下列给定的程序中,函数fun()的功能是:...
请补充函数fun(),该函数的功能是判断一...