重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 计算机类考试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[主观题]

请补充main函数,该函数的功能是:从键盘输入两上字符串...

请补充main函数,该函数的功能是:从键盘输入两上字符串并分别保存在字符数组str1和str2中,用字符串str2替换字符串str1前面的所有字符,注意,str2的K度不大于str1,否则需要重新输入。

例如,如果输入strl;=“abced”,str2=“fk”,则输出“fkced”。

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

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

试题程序:

include<stdio.h>

include<string. h>

main ()

{

char strl [ 81], str2 [ 81 ];

char *pl=strl, *p2=str2;

clrscr ();

do

{

printf(" Input strl tn");

gets (strl);

printf(" Input str2 In");

gets (str2);

}while(【 】);

while(【 】)

*p1++=*p2++;

printf(" Display strl \n");

puts (【 】)

}

查看答案
更多“请补充main函数,该函数的功能是:从键盘输入两上字符串...”相关的问题

第1题

请补充main函数,该函数的功能是:从键盘输入两上字符串并分别保存在字符数组str1和str2中,用字符串str2替换字符串str1前面的所有字符,注意,str2的K度不大于str1,否则需要重新输入。

例如,如果输入strl;=“abced”,str2=“fk”,则输出“fkced”。

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

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

试题程序:

include<stdio.h>

include<string. h>

main ()

{

char strl [ 81], str2 [ 81 ];

char *pl=strl, *p2=str2;

clrscr ();

do

{

printf(" Input strl tn");

gets (strl);

printf(" Input str2 In");

gets (str2);

}while(【 】);

while(【 】)

*p1++=*p2++;

printf(" Display strl \n");

puts (【 】)

}

点击查看答案

第2题

请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。

例如,输入abcdefghi*,结果显示adcdefghi。

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

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

试题程序:

include<stdio. h>

define N 80

main ()

{

iht i=-l, j=0;

char str IN];

clrscr ();

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

do

{

i++;

scanf(【 】);

}while(【 】);

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

while (j<i)

{

printf (【 】);

j++;

}

}

点击查看答案

第3题

请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。

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

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

试题程序:

include<stdio.h>

include<ctype.h>

main()

{

int i=0;

char a [81];

char *p=s;

clrscr ();

printf{" Input a string \n");

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

{

s [i] =getchar ( );

if (s [i]=='\n')

【 】;

}

s[i]=【 】

printf(" display the string \n");

while (*p)

putchar (【 】);

}

点击查看答案

第4题

请补充函数proc(),该函数的功能是:删除字符数组中小于指定字符的字符,指定字符从键盘输入,结果仍保存在原数组中。 例如,输人“abcdefghij”,指定字符为“f”,则结果输出“fghij”。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。 试题程序:

点击查看答案

第5题

请补充函数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);

}

点击查看答案

第6题

请补充函数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);

}

点击查看答案

第7题

请补充函数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);

}

点击查看答案

第8题

请补充函数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);

}

点击查看答案

第9题

请补充函数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题

从键盘输入一组小写字母,保存在字符数组str中。请补充函数proc(),该函数的功能是:把字符数组str中字符下标为奇数的小写字母转换成对应的大写字母,结果仍保存在原数组中。例如,输入abcdefg,输出aBcDeFg。

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

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

试题程序:

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

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

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

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

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

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

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

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案