",(*p)(x,y)); } double avg(double a,double b) { return((a+b)/2);}
举一反三
- 有以下程序,请填写正确语句,使程序可正常编译运行。 #include <stdio.h> ______; main() double x,y,(*p)(); scanf("%1f%1f",&x,&y); p=avg; printf("%f\n",(*p)(x,y)); double avg(double a,double b) return ((a+b)/2);
- 有以下程序,请在横线处填写正确语句,使程序可正常编译运行。[br][/br] #include ; main() { double x,y,(*p)(); scanf("%lf%lf",&x,&y); p=avg; printf("%f\n",(*p)(x,y)); } double avg(double a,double b) { return((a+b)/2);}
- 下列函数定义中正确的是()。 A: double fun(double x,y) { double z; z=x/y; return z; } B: double fun(double x, double y) { return x/y; } C: double fun(double x,y) { z=x/y; return z; } D: double fun(double x, double y) { z=x/y; return x/y; }
- <p>若程序中定义了以下函数,并将其放在调用语句之后,则在调用之前应该对该函数进行说明,以下选项中错误的说明是( )。</p><p >double myadd(double a,double b)</p><p >{ return (a+b); }</p> A: double myadd(double x,double y); B: double myadd(double b,double a); C: double myadd(double a,b); D: double myadd(double,double);
- 正确的函数定义是 A: double fun(int x;int y); {double z=x+y;return z;} B: double fun(int x,int y) {double z=x+y;return z;} C: double fun (x,y){double z;z=x+y;return z;} D: double fun (int x,y){double z;z=x+y;return z;}