搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友meikui 发布时间:2022-01-06
[主观题]

●试题四 请补充函数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));

}

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“●试题四 请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符”相关的问题
第1题
●试题四 请补充函数fun(),该函数可以统计一个长度为n的字符串在另一个字符串中出现的次数。例如,

●试题四

请补充函数fun(),该函数可以统计一个长度为n的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为:asd ascasdfg asd as asd mlosd,子字符串为asd,则应输出4。

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

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

试题程序:

#include<stdio.h>

#include<string.h>

#include<conio.h>

int fun(char *str,char *substr)

{

int n;

char *p,*r;

(1) ;

while(*str)

{

p=str;

r=substr;

while(*r)

if((2) )

{

r++;

p++;

}

else

break;

if((3) )

n++;

str++;

}

return n;

}

main()

{

char str[81],substr[3];

int n;

clrscr();

printf("输入主字符串:");

gets(str);

printf("输入子字符串:");

gets(substr);

puts(str);

puts(substr);

n=fun(str,substr);

printf("n=%d\n",n);

}

点击查看答案
第2题
请补充fun函数,该函数的功能是:判断一个年份是否为闰年。 例如,1900年不是闰年,2004是闰年。 [注意

请补充fun函数,该函数的功能是:判断一个年份是否为闰年。

例如,1900年不是闰年,2004是闰年。

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

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

[试题源程序]

include<stdio.h>

include<conio.h>

int fun(int n)

{

int fiag=0;

if(n%4==0)

{

if((1) )

fiag=1;

}

if((2) )flag=1;

return (3) ;

}

void main()

{

int year;

clrscr();

printf("Input the year:");

scanf("%d", &year);

if(fun(year))

printf("%d is a leap year.\n", year);

else

printf("%d is not a leap year.\n", year);

}

点击查看答案
第3题
请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。 例如:字符串中原有的字符串为abcd

请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。

例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。

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

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

试题程序:

$include<string.h>

include<conio.h>

include<stdio.h>

define N 81

void fun(char*s)

{

int i=0,t,n=strlen(s);

for(;【 】;i++)

{

t=*(s+i);

【 】;

【 】;

}

}

main()

{

char a[N];

clrscr();

printf("Enter a string:");

gets(a);

printf("The original string is:");

puts(a);

fun(a);

printf("\n");

printf("The string after modified:");

puts(a);

}

点击查看答案
第4题
请补充函数fun(),该函数的功能是:判断某一个年份是否为闰年。 例如,1900年不是闰年,2004是闰年。

请补充函数fun(),该函数的功能是:判断某一个年份是否为闰年。

例如,1900年不是闰年,2004是闰年。

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

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

试题程序:

include<stdio.h>

include<conio.h>

int fun(int n)

{

int flag=0;

if (n%4=0)

{

if (【 】)

flag=1;

}

if (【 】)

flag=1;

return【 】;

}

main()

{

int year;

clrscr();

printf("Input the year:");

scanf("%d", &year);

if (fun(year))

printf("%d is a leap year. \n", year);

else

printf("%d is not a leap year.\n",

year);

}

点击查看答案
第5题
请补充函数fun(),该函数的功能是:求100(不包括100)以内能被2或5整除,但不能同时被2和5整除的自然

请补充函数fun(),该函数的功能是:求100(不包括100)以内能被2或5整除,但不能同时被2和5整除的自然数。结果保存在数组bb中,函数fun()返回数组比元素的个数。

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

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

试题程序:

include <stdio.h>

define N 100

int fun (int bb [] )

{

int i, j;

for(【 】;i<100; i++)

if ((i%1!=0&&i%5==0)|| (i%2==0&&i%5 !=0)

【 】;

【 】;

}

main()

{

int i, n;

int bb [N];

clrscr ();

n=fun (bb);

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

{

if (i%10==0)

printf ("\n");

printf ("% 4d", bb [i]);

}

}

点击查看答案
第6题
请补充函数fun(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符

请补充函数fun(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。

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

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

试题程序:

include<stdio.h>

include<conio.h>

void fun(char *s)

{

int i=0;

char *p=s;

while(【 】)

{

if (*p>='a'&&*p<='z')

{

s[i]=*p;

【 】;

}

p++;

}

s[i]=【 】;

}

main()

{

char str[80];

clrscr();

printf("\nEnter a string:");

gets(str);

printf("\n\nThe string is:\%s\n",str);

fun(str);

printf("\n\nThe string of changing

is:\%s\n",str);

}

点击查看答案
第7题
请补充函数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);

}

点击查看答案
第8题
请补充函数fun(),该函数的功能是判断一个数的个位数字和百位数字之和是否等于其十位上的数字,是

请补充函数fun(),该函数的功能是判断一个数的个位数字和百位数字之和是否等于其十位上的数字,是则返回"yes!”,否则返回“no!”。

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

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

试题程序:

include<stdio.h>

include<conlo.h>

char*fun(int n)

{

int g,S,b;

g=n%l0;

s=n/10%10;

b=【 】;

if((g+b)==s)

return【 】;

else

return【 】;

}

main()

{

int num=0;

clrscr();

printf("******Input data*******\n");

scanf("%d",&num);

printf("\n\n\n");

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

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

}

点击查看答案
第9题
请补充函数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);

}

点击查看答案
第10题
请补充函数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);

}

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

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

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP