有以下程序,请填写正确语句,使程序可正常编译运行。 #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);}
- ",(*p)(x,y)); } double avg(double a,double b) { return((a+b)/2);}
- 以下程序的输出结果是____?double sub(double x,double y,double z){ y=-1; z=z+x; return z;}main(){ double a=2.5,b=9.0; printf("%f\n",sub(b-a,a,a));}
- 下列程序运行的结果是__________ 。#include <;stdio.h>;double sub(double x, double y, double z){y -= 1.0;z = z + x;return z;}int main( ){double a=2.5, b=9.0;printf("%6.2f\n", sub(b-a, a, a));return 0;}
- 有以下程序 #include double f (double x); main() { double a=0; int i; for(i=0;i<30;i+=10) a+=f((double)i); printf("%3.0f\n",a); } double f(double x) {return x*x+1;} 程序运行后的输出结果是()