单选题请读程序: #include void fun(float *pl, float *p2, float *s) { s=( float * )calloc( 1, sizeof(float)); *s=*p1+ *(p2++); } main( ) { float a[2]={1.1, 2.2}, b[2]={10.0, 20.0}, *s=a; fun(a, b, s) printf(""%f/n"",*s); } 上面程序的输出结果是()A11.100000B12.100000C21.100000D1.100000

单选题
请读程序: #include void fun(float *pl, float *p2, float *s) { s=( float * )calloc( 1, sizeof(float)); *s=*p1+ *(p2++); } main( ) { float a[2]={1.1, 2.2}, b[2]={10.0, 20.0}, *s=a; fun(a, b, s) printf(""%f/n"",*s); } 上面程序的输出结果是()
A

11.100000

B

12.100000

C

21.100000

D

1.100000


参考解析

解析: 暂无解析

相关考题:

若各选项中所用变量已正确定义,函数 fun 中通过 return 语句返回一个函数值,以下选项中错误的程序是A)main(){ …… x=fun(2,10); …… }float fun(int a,int b){ …… }B)float fun(int a,int b){ …… }main(){ …… x=fun(i,j); …… }C)float fun(int,int);main(){ …… x=fun(2,10); …… }float fun(int a,int b) { …… }D)main(){ float fun(int i,int j);…… x=fun(i,j); …… }float fun(int a,int b){ …… }

下列程序段不会发生二义性的是_。 A.int fun(double p){…;} float fun(float p){…;} int x; x=fun(0);B.int fun(float p){…;}float fun(unsigned p){…;} int x; x=fun(0);C.int fun(int i,int j=2){…;}float fun(int i){…;} coutfun(5);D.int fun(int i=2,int j=2){…;} int fun(int *p){…;} coutfun(5);

函数 void fun(float *sn, int n)的功能是:根据以下公式计算S,计算结果通过形参指针sn传回;n通过形参传入,n的值大于等于0。请填空。void fun( float *sn, int n){ float s=0.0, w, f=-1.0;int i=0;for(i=0; i=n; i++){ f=( )* f;w=f/(2*i+1);s+=w; }( )=s;}

阅读以下说明C++代码,将应填入(n)处的字句写在对应栏内。[说明]以下程序的功能是实现堆栈的一些基本操作。堆栈类stack共有三个成员函数:empty判断堆栈是否为空;push进行人栈操作;pop进行出栈操作。[C++程序]include "stdafx. h"include <iostream, h>eonst int maxsize = 6;class stack {float data[ maxsize];int top;public:stuck(void);~ stack(void);bool empty(void);void push(float a);float pop(void);};stack: :stack(void){ top =0;cout < < "stack initialized." < < endl;}stack:: ~stack(void) {cout < <" stack destoryed." < < endl;bool stack:: empty (void) {return (1);void stack: :push(float a)if(top= =maxsize) {cout < < "Stack is full!" < < endl;return;data[top] =a;(2);}float stack:: pop (void){ if((3)){cout< < "Stack is undcrflow !" < < endl;return 0;(4);return (5);}void main( ){ stack s;coat < < "now push the data:";for(inti=l;i =maxsize;i+ +) {cout< <i< <" ";s. push(i);}coat < < endl;cout< < "now pop the data:";for(i = 1 ;i < = maxsize ;i + + )cout< <s. pop()< <" ";}

给定程序MODI1.C中函数fun的功能是:用下面的公式:π/4=1-1/3+1/5-1/7+.....求x的近似值,直到最后一项的绝对值小于指定的数(参数num)为止:例如,程序运行后,输入0.0001,则程序输出3.1414。请改正程序中的错误,使它能输出正确的结果。_______注意:不要改动smain函数,不得增行或删行,也不得更改程序的结构!include 〈 math.h 〉include 〈 stdio.h 〉float fun (float num){ int s ;float;n,t,pi ;t=1;pi=0;n=1;s=1;/**********found**********/while(t 〉=num){pi = pi + t ;n = n +2 ;s=-s ;/**********found**********/t = s % n ;}pi=pi*4 ;return pi ;}main(){ float n1,n2;printf(Enter a float number:);scanf(%f, n1);n2=fun(n1);printf(%6.4f\n,n2);}

以下函数的功能是【18】。float av(a, n)float a[];int n;{ int i; float s;for(i=0, s=0; ireturn s/n;}

下列程序的招待结果是【 】。 include float temp;float fn2(float r){ temp=r* 下列程序的招待结果是【 】。include <iostream. h>float temp;float fn2(float r){temp=r* r* 3.14;return temp;}void main( ){float a=fn2(5.0);float b=fn2(5.0)b=20;cout<<temp<<end1;}

设有如下程序: fun(float*p1,int n,float*p2,int m,float*s) {int i; *s=0.0; for(i=0;i<n;i++)*s+=*p1++; for(i=0;i<m;i++)*s+=*p2++; } main() { float a[]={1.1,2.2},b[]={1.0,2.0,3.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是______。A.8.2B.9.3C.3.3D.1.1

下面各被调用函数首部书写正确的是( )A.void sub(float x;float y);B.void sub(float x,y)C.void sub(float x,float y)D.void sub(float x,float y);

下列程序的执行结果是______。 include float temp; floatfn2(float r) { temp= 下列程序的执行结果是______。include<iostream.h>float temp;floatfn2(float r){temp=r*r*3.14;return temp;}void main( ){float a=fn2(5.0);floatb=fn2(5.0);b=20;cout<<temp<<endl;}

下列程序的执行结果是______。 include class Student { public: Student(int xx){x= 下列程序的执行结果是______。include<iostream.h>class Student{public:Student(int xx){x=xx;}virtual float calcTuition( );protected:int x;};float Studertt::calcTuition( ){return float(x*x);}class GraduateStudent:public Student{public:GraduateStudent(int xx):Student(xx){}float calcTuition( );};float Graduatestudent::calcTuition( ){return float(x*2);}void main( ){Student s(20);GraduateStudent gs(30);cout<<s.calcTuition( )<<" "<<gs.calcTuition( )<<endl;//计算学生s和研究生gs的学费}

有以下程序 float fl(float n) { return n*n; } float f2(float n) { return 2*n;} main() {float(*p1)(float),(*p2)(float),(*t)(float),y1,Y2; p1=f1; p2=f2; y1=p2(p1(2.O)); t=p1; p1=p2; p2=t; y2=p2(pl(2.0)); printf("%3.0f,%3,Of\n",y1,y2); } 程序运行后的输出结果是A.8,16B.8,8C.16,16D.4,8

请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值

使用VC6打开考生文件夹下的工程test35_1,此工程包含一个源程序文件test35_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:40040源程序文件test35_1.cpp清单如下:include <iostream.h>class Student{public:Student(int xx){x=xx;}virtual float calcTuition();/***************** found *****************/private:int x;};float Student::calcTuition(){return float(x'x);}/***************** found *****************/class GraduateStudent::public Student{public:/***************** found *****************/GraduateStudent(int xx) ::Student(xx){}virtual float calcTuition();};float GraduateStudent::calcTuition(){return float(x*2);}void main(){Student s(20);GraduateStudent gs(20);cout<<s.calcTuition()<<end1;cout<<gs.calcTuition()<<end1;}

以下4个程序中,不能实现两个实参值进行交换的是 ( )。A.void swap (float *p, float *q) { float *t ,a; t = a; t = p; *p = *q; *q = *t; } void main () { float x = 8.0;y = 9.0; swap (x, y); cout<<x<<", "<<y<<B.void swap (float *p, float *q) { float a; a = *p; *p = *q; *q = a; } void main() { float x = 8.0;y = 9.0; swap (x, y); cout<<x<<", "<<y<<end1;C.void swap (float *p, float *q) { float x; x = *p; *p = *q; *q = x; } void main() { float a,b.; *a = 8.0;*b = 9.0; swap (a, b) ;D.void swap (float p, float q) { float a; a = p; p = q; q = a; } void main() { float a = 8.0,b = 9.0; swap (a,b); cout<<x<<", "<<y<<

有以下程序includevoid fun(float* p1,int n1,float,*p2,int n2,float* s){ int i;s=( 有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )A.60B.3.3C.63.3D.1.1

以下程序的输出结果是 void fun(float*p1,float*p2,float*s) { s=(float*)calloc(1,sizeof(float)); *s=*p1+*p2++;} main() { float a[2]={1.1,2.2},b[2]={10.0,20.0},*s=a; fun(a,b,s); printf("%5.2f\n",*s);}A.11.1B.12C.21.1D.1.1

下列给定程序中,函数fun()的功能是:用下面的公式求π的近似值,直到最后一项的绝对值小于指定的数(参数num)为止。π/4≈1-1/3+1/5-1/7+…例如,程序运行后,输入0.0001,则程序输出3.1414。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <math.h>include <stdio.h>float fun(float num){ int s;float n,t, pi;t=1 ;pi=0; n=1; s=1;/**************found***************/while (t>=num){pi=pi+ t;n=n+2;s=-s;/**************found**************/t=s% n;}pi=pi*4;return pi;}main (){ float n1, n2;clrscr ();printf ("Enter a float number: ");scanf ("%f", n1);n2=fun (n1);print f (" %6.4 f\n ", n2);}

有以下程序:include float f1 (float n ){return n*n;}float f2 ( float n){return 2 有以下程序:#include <stdio.h>float f1 (float n ){ return n*n;}float f2 ( float n){ return 2 * n;}main( ){ float ( * p1)(float),( * p2)(float),(*t)(float) ,y1,y2; p1 = f1;p2 = f2; y1 = p2(p1(2.0) ); t =p1;p1 = p2;p2 =t; y2=p2(p1(2.0)); prinff("% 3.0f, %3.Of\n" ,y1,y2);}程序运行后的输出结果是( )。A.8,16B.8,8C.16,16D.4,8

下列重载函数中,正确的是( )。A.void fun(int a,float b);void fun(int C,float d)B.void fun(int a,float b);void fun(float a,int b)C.float fun(int a,float b);int fun(int b,float a)D.int fun(int a,int b);float fun(int a,int b)

有以下程序 include struct STU { char num[10]; float score[3];}; void ma 有以下程序 #include<iostream.h> struct STU { char num[10]; float score[3];}; void main( ) { struct STU s[3]={ { "20021",90,95,85 }, {"20022",95,80,75 }, {"20023",100,95,90 } },* p=s; int i; float sum=0; for(i=0;i<A.260B.270C.280D.285

有以下程序:include include struet STU{ int nam;float TotalSeore;};v 有以下程序:#include <stdio, h>#include <string, h>struet STU{ int nam; float TotalSeore;};void f( strnct STU p){ struct STU s[2] = { {20044,550} ,{20045,537} }; p.num = s [1]. num; p.TotalScore = s [1]. TotalScore;main( ){ struct STU s[2] = {{20041,703} ,{20042,580}}; f(s[0] ); printf( "%d %3.Of\n" ,s[0].num,s[0].TotalSeore); }程序运行后的输出结果是( )。A.20045 537B.20044 550C.20042 580D.20041 703

下面的方法重载,正确的是()。A、int fun(int a, float b) { } float fun(int a, float b) { }B、float fun(int a, float b) { } float fun(int x, float y) { }C、float fun(float a) { }  float fun(float a, float b) { }D、float fun1(int a, float b) { } float fun2(int a, float b) { }

请读程序: #include void fun(float *pl, float *p2, float *s) { s=( float * )calloc( 1, sizeof(float)); *s=*p1+ *(p2++); } main( ) { float a[2]={1.1, 2.2}, b[2]={10.0, 20.0}, *s=a; fun(a, b, s) printf(""%f/n"",*s); } 上面程序的输出结果是()A、11.100000B、12.100000C、21.100000D、1.100000

请读程序:#includevoidfun(float*pl,float*p2,float*s){s=(float*)calloc(1,sizeof(float));*s=*p1+*(p2++);}main(){floata[2]={1.1,2.2},b[2]={10.0,20.0},*s=a;fun(a,b,s)printf(""%f/n"",*s);}上面程序的输出结果是()A、11.100000B、12.100000C、21.100000D、1.100000

单选题下列重载函数中,正确的是(  )。Avoid fun(int a,float b);void fun(int C,float d)Bvoid fun(int a,float b);void fun(float a,int b)Cfloat fun(int a,float b);int fun(int b,float a)Dint fun(int a,int b);float fun(int a,int b)

问答题请根据以下各小题的要求设计C应用程序(包括界面和代码)。  下列给定的程序中,函数fun的功能是:把主函数中输入的3个数,最大的放在a中,最小的放在c中。例如,输入的数为55 12 34,输出结果应当是:a=55.0,b=34.0,c=12.0。  请改正程序中的错误,使它能得到正确结果。  注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。  试题程序如下:#include #include void fun(float *p,float *q,float *s){ float *k; k = (float *)malloc(sizeof(float)); if(*p*q) {  /**********found**********/  k=*p;*p=*q;*q=k; } /**********found**********/ if(*s*p) {  /**********found**********/  k=*s; *s=*p; *p=k; } if(*q*s) {  /**********found**********/  k=*q; *q=*s; *s=k; } free(k);}main(){ float a,b,c; printf(Input a b c: ); scanf(%f%f%f,a,b,c); printf(a = %4.1f, b = %4.1f, c = %4.1f,a,b,c); fun(a,b,c); printf(a = %4.1f, b = %4.1f, c = %4.1f,a,b,c);}

单选题下面的方法重载,正确的是()。Aint fun(int a, float b) { } float fun(int a, float b) { }Bfloat fun(int a, float b) { } float fun(int x, float y) { }Cfloat fun(float a) { }  float fun(float a, float b) { }Dfloat fun1(int a, float b) { } float fun2(int a, float b) { }