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

请补充代码使其编译正确无误。 【重要提醒】请不要在答案的字符左右随意添加空格。 class Magic { do

uble x; public: Magic(double b=0.00):x(fabs(d)) { } Magic operator+(Magic &c) { return Magic(sqrt(x*x + c.x*c.x)); } (1) operator<<(ostream & stream, magic &c) { return stream; }>

暂无答案
更多“请补充代码使其编译正确无误。 【重要提醒】请不要在答案的字符左右随意添加空格。 class Magic { do”相关的问题

第1题

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

}

点击查看答案

第2题

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

}

点击查看答案

第3题

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

}

点击查看答案

第4题

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

}

点击查看答案

第5题

请补充main函数,改函数的功能是,把一个二维字符数组每行字符串最大的字符拷贝到字符数组s中。

例如,如果str[3]={"efjh","cfimls","owys"},则s;"hsy"。

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

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

试题程序:

inc lude<stdio, h>

main()

{

int i=0;

char *str [3] ={ "efjh", "efknls",

"owys" };

char **p;

char s [8];

clrscr 0;

【 】;

for (i=O; i<3; i++)

{

s [i] =*p [i];

while (*p [i] )

{

if (S [i] <*p [i] )

s [i] =*p[i];

【 】;

}

}

【 】;

printf(" new string \n");

puts (s);

}

点击查看答案

第6题

请补充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 (【 】);

}

点击查看答案

第7题

str是一个由数字和字母字符组成的字符串,由变量hum传入字符串长度。请补充函数fun( ),该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。

例如:str=“Bcdl23e456hui890”,结果为:123456890。

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

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

试题程序:

include<stdio.h>

define N 80

int bb[N];

int fun(char s[ ],int bb[ ],int num)

{

int i,n=0;

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

{

if(【 】)

{

bb[n]=【 】;

n++;

}

}

return【 】;

}

main()

{

char str[N];

int num=0,n,i;

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

gets(str);

while(str[num])

num++;

n=fun(str,bb,num);

printf("\nbb=");

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

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

}

点击查看答案

第8题

str是一个由数字和字母字符组成的字符串,由变量num传入字符串长度。请补充函数proc,该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。

例如,str="abc3de987f9621",结果为:3987621。

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

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

试题程序:

include<stdio.h>

define M 80

int bb[M];

int proc(char str[],int bb[],int num)

{

int i,n=0;

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

{

if(【1】)

{

bb[n]=【2】:

n++:

}

}

return 【3】 ;

}

void main

{

char str[M];

int mum=0,n,i;

printf("Enter a strin9:\n");

gets(str);

while(str[num])

num++:

n=proc(str,bb,num);

printf("\nbb=");

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

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

}

点击查看答案

第9题

str是一个由数字和字母字符组成的字符串,由变量num传人字符串长度。请补充函数proc,该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。 例如,str="abcl23de45f967",结果为:l234567。 注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在函数proc的横线上填入所编写的若干表达式或语句。 试题程序: include<stdio.h> define M 80 int bb[M]; int proc(char str[],int bb[],int num) { int i,n=0; for(i=0;i<num;i++) { if( 【1】 ) { bb[n]=【2】 ; n++; } } return 【3】 ; } void main { char str[M]; int num=0,n,i; printf("Enter a string:\n"); gets(str); while(str[num]) num++: n=proc(str,bb,num); printf("\nbb="); for(i=0;i<n;i++) printf("%d",bb[i]); }

点击查看答案

第10题

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

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

1. 搜题次数扣减规则:

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

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

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

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

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

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

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

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

上学吧找答案