题目内容 (请给出正确答案)
[主观题]

请补充函数fun,该函数的功能是比较字符串str1和str2的大小,井返回比较的结果。 例如:当str1=“cdef

请补充函数fun,该函数的功能是比较字符串str1和str2的大小,井返回比较的结果。

例如: 当str1=“cdef",str2=“cde”时,函数fun()返回“>”。

注意:部分源程序给出如下。

请勿改动主函数main 和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include< stdio, h>

include<conio. h>

define N 80

char *fun (char *str1,char *str2)

{

char *p1=str1, *p2=str2;

while (*p1 & & *p2 )

{

if (【 】)

return "<";

if(【 】)

return ">";

p1++;

p2++;

}

if (*p1=*p2)

return "==";

if (*p1==【 】)

return "<";

else

return ">";

}

main()

{

char str1 [N], str2 [N];

clrscr ();

printf ("Input str1: \n");

gets (str1);

printf ("Input str2: \n");

gets (str2);

printf ("\n*****the result*****\n");

printf ("\nstr1 %s str2", fun (str1, str2) );

}

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“请补充函数fun,该函数的功能是比较字符串str1和str2…”相关的问题

第1题

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍然保存在字符串str中,字符串str从键盘输人,其长度作为参数传人fun()函数。

例如,输入“abcdef”,则输出“bdf”。

注意:部分源程序给出如下。

请勿改动main()函数和其他函数中的任何内容,仅在mare()函数的横线上填入所编写的若干表达式或语句。

试题程序:

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍

请补充fun()函数,该函数的功能是:把字符的ASCII码中为奇数的字符从字符串str中删除,结果仍

点击查看答案

第2题

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。 注意:部分

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

define N 80

int fun (char s[],char ch)

{

int i=0, n=0;

while(【 】)

{

if(【 】)

n++;

i++;

}

【 】;

}

main ()

{

int n;

char str[N], ch;

clrscr ();

printf ("\nInput a string: \n");

gets (str);

printf ("\nInput a charactor: \n" ;

scanf ("%c", &ch);

n=fun (str, ch);

printf("\nnumber of %c:%d", ch, n);

}

点击查看答案

第3题

请补充函数fun(),该函数的功能是;删除字符数组中小于等于指定字符的字符,指定字符从键盘输入,结

请补充函数fun(),该函数的功能是;删除字符数组中小于等于指定字符的字符,指定字符从键盘输入,结果仍保存

例如,输入“abcdefghij”,指定字符为‘d’,则结果输出“defghij”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio. h>

define N 80

void fun (char s[], char ch)

{

int i=0, j=0;

while (s [i] )

{

if (s Iii<ch)

【 】;

else

{

【 】

i++;

}

}

【 】

}

main ()

{

char str [N], ch;

clrscr ();

printf("\n Input a string:\n");

gets (str);

printf("\n*** original string ***\n");

puts (str);

printf("\n Input a character:\n");

scanf ("%c", &ch);

fun(str, ch);

printf("\n*** new string ***\n");

puts (str);

}

点击查看答案

第4题

●试题四 请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符

●试题四

请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入"Are you come from Sichuan?",则输入"are you come from sichuan?"。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

#include<stdio.h>

#include<string.h>

#include<conio.h>

char *fun(char tt[])

{

int i;

for(i=0;tt[i];i++)

{

if((tt[i]>=′A′)&&((1) ))

(2) ;

}

return ((3) ) ;

}

main()

{

char tt[81];

printf("\nPlease enter a string:");

gets(tt);

printf("\nThe result string is: \n%s",

fun(tt));

}

点击查看答案

第5题

请补充函数fun(),该函数的功能是:把字符下标能铍2或3整除的字符从字符串str中删除,把剩余的字符

请补充函数fun(),该函数的功能是:把字符下标能铍2或3整除的字符从字符串str中删除,把剩余的字符重新保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。

例如,输入“abcdefghijk”,输出“bfh”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

define N 80

void fun(char s[], int n)

{

int i, k;

【 】;

for(i=0; i<n; i++)

{

s[k++]=s[i];

if(【 】)

k--;

}

【 】;

}

main()

{

int i=0,strlen=0;

char str[N];

clrscr();

printf("\nInput a string:\n");

gets(str);

while(str[i]!='\0')

{

strlen++;

i++;

}

fun(str,strlen);

printf('\n*** display string ***\n");

puts(str);

}

点击查看答案

第6题

有以下函数int fun(char *s){ char *t=s;while(*t++);return(t-s);}该函数的功能是A) 比较

有以下函数

int fun(char *s)

{ char *t=s;

while(*t++);

return(t-s);

}

该函数的功能是

A) 比较两个字符 串 的大小

B) 计算 s 所指字符串占用内存字节的个数

C) 计算 s 所指字符串的长度

D) 将 s 所指字符串复制到字符串 t 中

点击查看答案

第7题

请补充函数fun(),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,

请补充函数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;【 】;i++)

if(【 】)

{

t=1;

break;

}

if (【 】)

return("yes!");

else

return("no!");

}

main()

{

char str[50];

printf("Input;");

scanf("%s",str);

printf("%s\n",fun(str));

}

点击查看答案

第8题

请补充函数fun(),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的

请补充函数fun(),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun()。

例如,输入“abcdefghijkl”,输出“cdfhl”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

define N 80

void fun(char s[],int n)

{

int i, j, k, flag;

【 】;

for(i=0; i<n; i++)

{

if (i>1)

s [k++] =s [i];

flag=I;

for(【 】; j<i&&flag; j++)

if (i%j==0)

{

flag=0;

【 】

}

}

s [k]='\0';

}

main()

{

int i=0, strlen=0;

char str[N];

clrscr ();

printf("\n Input a string:\n");

gets (str);

while (str [i] !='\0')

{

strlen++;

i++;

}

fun (str, strlen);

printf("\n*** display string ***\n");

puts (str);

}

点击查看答案

第9题

请补充函数fun(),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码降序排列,处理后的字符串仍

请补充函数fun(),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码降序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传入。

例如,如果输入“cdefgh”,则输出为“hgfedc”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

define N 80

void fun (char s [], int n)

{

int i, j;

char ch;

for (i=0; i<n; i++)

for(j=【 】;j<n;j++)

if (s[i]<s [j])

{

ch=s [j];

【 】;

s [i] =ch;

}

main ()

{

int i=0, strlen=0;

char str [N];

clrscr ();

printf ("\nInput a string: \n");

gets (str);

while (str [i] !=' \0')

{

strlen++;

i++;

}

fun (str, strlen);

printf ("\n***display string ***\n");

puts (str);

}

点击查看答案

第10题

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串

请补充函数fun(),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun()。

例如,输入“abcdef”,输出“bdf”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

define N 80

void fun(char s[],int n)

{

int i, j;

j=0;

for(i=0;【 】;i++)

{

if(【 】)

s [j++]-s [i];

}

【 】;

}

main ()

{

int i=0, strlen=0;

char str [N];

clrscr ();

printf ("\nInput a string: \n");

gets (str);

while (str [i] !='\0')

{

strlen++;

i++;

}

fun(str, strlen);

printf("\n*** display string ***\n");

puts (str);

}

点击查看答案

第11题

请补充函数fun(),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串s

请补充函数fun(),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串srt中,字符串str从键盘输入,其长度作为参数传入函数fun()。

例如,输入“abcdef”,输出“ace”。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

inc lude< stdio, h>

define N 80

【 】

{

int i, j;

【 】

for (i=0;i<n;i++)

{

if (s [i] %2!=0)

s [j++]=s [i];

}

【 】;

}

main ()

{

int i=0, strlen=0;

char str[N];

clrscr ();

printf ("\nInput a string:\n");

gets (str);

while (str [i] !=' \0' )

{

strlen++;

i++;

}

fun (str, strlen);

printf("\n*** display string ***\n");

puts (str);

}

点击查看答案
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
温馨提示
每个试题只能免费做一次,如需多次做题,请购买搜题卡
立即购买
稍后再说
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
赏学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反赏学吧购买须知被冻结。您可在“赏学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
赏学吧
点击打开微信