首页 > 建筑工程类考试
题目内容 (请给出正确答案)
[主观题]

有以下程序#include<stdio.h>int fun(char s[]){int n=0;while(*s<='9'&&*s>

有以下程序

#include<stdio.h>

int fun(char s[])

{int n=0;

while(*s<='9'&&*s>='0'){n=10*n+*s-'o';s++;)

return(n);

}

main

{char s[10]={'6','1','*','4','*','9','*',' 0','*');

printf("%d",fun(s));

}

程序运行的结果是()。

A.9

B.61490

C.61

D.5

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有以下程序#include<stdio.h>int fun(…”相关的问题
第1题
有以下程序: #include < stdio. h > main () int a=3,b=4,c=5,d=2;if(a>b) if(b>c)printf("%d",

有以下程序: #include < stdio. h > main () int a=3,b=4,c=5,d=2; if(a>b) if(b>c)printf("%d",d++ +1); else printf("% d", + + d + 1 ); printf("% d \n" ,d); 程序运行后的输出结果是()。

A.2

B.3

C.43

D.44

点击查看答案
第2题
有以下程序#include<stdio. h>main(){charc1='1',c2='2';c1=getchar();c2=getchar();putchar(c1)

有以下程序#include<stdio. h>main(){ char c1='1',c2='2'; c1=getchar(); c2=getchar(); putchar(c1); putchar(c2);} 当运行时输入:a<回车> 后,以下叙述正确的是

A.变量c1被赋予字符a,c2被赋予回车符

B.程序将等待用户输入第2个字符

C.变量c1被赋予字符a,c2中仍是原有字符2

D.变量c1被赋予字符a,c2中将无确定值

点击查看答案
第3题
若有如下程序,则程序运行结果为:()#include<stdio. h>main(){ int x=1, a=0;switch (x)case 1:a++;case 2: a++ ;break;case 3: a++ ; break;printf(”a=%d\n" ,a)

A.=0

B.=1

C.=2

D.=3

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

}

点击查看答案
第5题
下列给定程序中,函数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);

}

点击查看答案
第6题
请编写函数fun(),该函数的功能是:移动字符串中的内容,移动的规则是把第1到第m个字符,平移到字符

请编写函数fun(),该函数的功能是:移动字符串中的内容,移动的规则是把第1到第m个字符,平移到字符串的最后,把第m+1到最后的字符移到字符串的前部。

例如,字符串中原有的内容为ABCDEFGHIJK,m的值为 3,移动后,字符串中的内容应该是DEFGHIJKABC。

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

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

试题程序:

include <stdio. h>

include <string.h>

define N 80

void fun (char *w, int m)

{

}

main ()

{

char a[N]= "ABCDEFGHIJK";

int m;

printf ("The origina string : \n");

puts (a);

printf("\n\nEnter m: ");

scanf ("%d", &m);

fun (a, m);

printf (" \nThe string after moving : \n");

puts (a);

printf ("\n\n");

}

点击查看答案
第7题
有以下程序()

A.#include

B.abcdef

C.ABCDEF

D.aBcDeF

E.AbCdEf

点击查看答案
第8题
有以下程序()

A.#include

B.5

C.24

D.32

E.40

点击查看答案
第9题
有以下程序#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

点击查看答案
第10题
有以下程序()

A.#include

B.y=-1

C.y=0

D.y=1

E.while构成无限循环

点击查看答案
第11题
有以下程序 #include <stdio.h> int fun(int a, int b) { if(b==0) return a;

有以下程序 #include <stdio.h> int fun(int a, int b) { if(b==0) return a; else return(fun(-a,-b)); } main() { printf("%d\n",fun(4,2)); } 程序的运行结果是______。

A.1

B.2

C.3

D.4

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