首页 > 大学专科> 电子信息
题目内容 (请给出正确答案)
[主观题]

有以下程序 include<stdio.h> intfun(charS[]) {intn=0; while(*s<=9&&*s>=0){n=10*n+*S-0;s

有以下程序 include<stdio.h> intfun(charS[]) {intn=0; while(*s<=9&&*s>=0){n=10*n+*S-0;s++;) return(n); } main() {chars[10]={6,1,*,4,*,9,*,0,*); printf(%d\n,fun(s)); } 程序的运行结果是

A.61490

B.61

C.9

D.5

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序 include<stdio.h> intfun(…”相关的问题
第1题
以下程序用来统计文件中字符个数。请填空。 include "stdio. h" main() { FILE *fp;long

以下程序用来统计文件中字符个数。请填空。 include "stdio. h" main() { FILE *fp;long num=OL; if((fp=fopen("fname.dat","r")==NULL) { Pirntf("Open error\n"); exit(0);} while(【 】) { fgetc(fp);num++; } printf("num=%1d\n",num-1); fclose(fp); }

点击查看答案
第2题
以下程序的功能是将字符串s中的数字字符放人d数组中,最后输出d中的字符串。例如,输入字符串abc123
edf456gh,执行程序后输出123456。请填空。 include<stdio. h> include<ctype. h> main() { char s[80], d[80]; int i, j; gets(s); for(i=j=0; s[i]!=\0; i++) if(【 】){ d[j]=s[i]; j++;) d[j]=\0; puts(D) ; }

点击查看答案
第3题
以下程序通过函数SunFun()调用F(x),x的值从0到10,这里F(x)=x2+1,由F函数实现,请填空。 inc

以下程序通过函数SunFun()调用F(x),x的值从0到10,这里F(x)=x2+1,由F函数实现,请填空。 include <stdio. h> int SunFun(int); int F(int); main () { pfintf("The sum = % d \n" ,SunFun(10) ); } SunFun(int n) { int x,s =0; for(x=0; x<=n; x++) s+ =F(【 】); return s; F(int x) { return (【 】);}

点击查看答案
第4题
下面程序由两个源程序文件:t4.h和t4.c组成,程序编译运行的结果是:【 】。 t4.h 的源程序为: d
efine N 10 denne f2(x) (x*N) t4.c 的源程序为: include <stdio. h> define M 8 define f(x) ((x)*M) include "t4.h" main() { int i, j; i=f(1+1); j=f2(1+1); printf(%d%d\n",i, j); }

点击查看答案
第5题
下面程序的功能是:将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。 include <s
tdio. h> include <string.h> main () { char a [] ="clanguage", t; int i, j, k; k=strlen (a); for(i=0; i<=k-2; i+=2) for(j=i+2; j<=k;【 】 ) if(【 】) { t=a[i]; a[i]=a[j]; a[j]=t; } puts (a); printf ("\n"); }

点击查看答案
第6题
下面程序的功能:输出100以内能被3整除且个位数为6的所有整数,请填空。 include<stdio.
h> main() { int i, j; for(i=0; i<10或i<=9; i++) { j=i*10+6; if(【 】)continue; printf("% d", j); } }

点击查看答案
第7题
下面程序的功能:将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。请填空。 inclu
de<stdio. h> include<string. h> main() { char a[]="clanquage", t; int i, j, k; k=strlen(A) ; for(i=0; i<=k-2; i+=2) for(j=i+2;j<k; j+=2) if(【 】) { t=a[i]; a[i]=a[j]; a[j]=t; } puts(A) ; printf("\n"); }

点击查看答案
第8题
下列程序能将字符串s1中的所有与字符串str1相同的子串替换成字符串sb2,并将替换后的新串存于字符
数组s2中。 include<stdio. h> void replace(s1,s2,str1,str2) char *s1,*s2,*str1,*str2; { char *t0,*t1,*t2,*x,*y; x=s1;y=s2; while(【 】) { for(t0=s1,t1=str1; ((*t1!=\O&& 【 】;t0++,t1++); if(*t1!=\0) *s2++=【 】; else { for(t1=str2;*t1!=\0;) *s2++= 【 】; 【 】; } } *s2=\0; } main () { static char s1[]="abcdef ababcd abab.",s2125]; replace (s1, s2, "abc", "XYZ"); printf("%s\n",s2); }

点击查看答案
第9题
请编写函数fun(),该函数的功能是:计算并输出 S=1+(1+20.5)+(1+20.5+30.5)+…+(1+20.5+30.5+…+n0.5

请编写函数fun(),该函数的功能是:计算并输出

S=1+(1+20.5)+(1+20.5+30.5)+…+(1+20.5+30.5+…+n0.5)

例如,若主函数从键盘给n输入20后,则输出为

s=534.188884。

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

请勿改动主函数main 和其他函数中的任何内容,仅在函数fun 的花括号中填入所编写的若干语句。

试题程序:

include <math. h>

include <stdio. h>

double fun(int n)

{

}

main()

{

int n;

double s;

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

scanf ("%d", &n);

s=fun (n)

printf ("\n\ns=%f\n\n", s);

}

点击查看答案
第10题
下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和

下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和y不相等,z和y不等。例如,当x的值为9,y的值为11,2的值为15时,函数值为-3.50。

请改正程序中的错误,使它能得出正确的结果。

注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。

试题程序:

include <stdio. h>

include <math. h>

/**************found******************/

define FU(m, n) (m/n)

float fun(float a, float b, float c)

{ float value;

value=FU(a+ b, a-b)+FU(c+ b, c-b);

/*************found******************/

return(Value);

}

main()

{ float x, y, z, sum;

printf ("Input x y z:: ");

scanf("%f%f%f", &x, &y, &z);

printf("x=%f, y=%f, z=%f\n ",x, y, z);

if (x==y||y==z) {printf ("Data error! \n ");

exit (0); }

sum=fun (x, y, z);

printf("The result is:%5. 2f\n ",sum);

}

点击查看答案
第11题
有以下程序#include<stdio.h>#include<string.h>main(){char a[10]=”abcd”;prinff(“

有以下程序

#include<stdio.h>

#include<string.h>

main()

{char a[10]=”abcd”;

prinff(“%d,%d\n”,strlen(A),sizeof(A));

}

程序运行后的输出结果是

A.7,4

B.4,10

C.8,8

D.10,lO

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改