1、理论部分参考答案 2009春答案 1-6 DDCC BBAA DCBA ABCD ABCB ADCD 7 #include #include double fact(int n) double res=1;int i; for(i=1;i=e;i+) t=pow(x,i)/fact(i);s=s+t; return s; void main() float x,e; scanf(“%f%f“, printf(“%lfn“,cal(x,e); 2009秋答案 一、 1-6 DACB BCAD DCBA AABB CCDD ABCD 二、 1 #include main() int i,a100,
2、min,min_i; for(i=0;i double cal_power(float x,int n) int i; double m=1; for(i=1;i main() int i,a100;long s=0; for(i=0;i int total(int n) int i,s=0; for(i=1;i void main() int a100, x, i, count=0 ; printf(“Input 100 integers:n“); for ( i=0; i void main() double s=0; int n, i ; do scanf(“%d“, while (n
3、void main() int a100,x,i,s=0; for(i=0;i=x) s+; printf(“%dn“,s); 2 #include double f(int n) int i; double s=1; for(i=n;i void main() int i,n=0;float a100; for(i=0;i double f(int n) int i;double s=0; for(i=n;i void main() int m,n,i,j,a66,s6=0; printf(“请输入 m,n(16 | n6); for(i=0;i double fun(int x) retu
4、rn x*x-3.14*x-6; void main() int x;double s=0; printf(“x yn“); for(x=-10;x void main() int n,i,j,s=0,a66; printf(“请输入 n(16); for(i=0;i double power(double x,int n) int i;double s=1; for(i=1;i void main() int x; scanf(“%d“, if(x=0) printf(“0n“); else if(x double f(double x) return (x+1)*(x+1); void m
5、ain() double x; printf(“ x yn“); for(x=-1.0;x void main() int i,n=0;float a100; for(i=0;i=90) n+; printf(“ 优秀学生 人数是: %d。 n” ,n); 2 #include double f(int n) int i;double s=0; for(i=n;i void main() int m,n,i,j,c=0;float s=0,a66; do printf(“请输入 m(16); do printf(“请输入 n(16); printf(“请输入 %d 个数: “,m*n); fo
6、r(i=0;is/(m*n) c+; printf(“大于平均值的元素个数为: %d。 n“,c); 2 #include double fact(int n) int i; double s=1; for(i=1;i void main() int a100,i,max,count=0; for(i=0;imax) max=ai; for(i=0; i #include double fun(double x) return pow(x,3)+2.0*pow(x,2)-3.9*x+8; void main() double x; printf(“ x yn” ); for(x=-2.0;x
7、void main() int a10,i,max,maxi,t; for(i=0;imax) max=ai; maxi=i; t=a0; a0=amaxi; amaxi=t; for(i=0;i double fun(double x) return x*x-6.5*x+2; void main() double x; printf(“ x yn“); for(x=-3;x void main() int n,i,j,ii,jj; float a66,min; scanf(“%d“, for(i=0;i #include double dist(double x,double y) return sqrt(x*x+y*y); void main() int i; double x10,y10; for(i=0;i 按位右移 转换二进制,按位右移; 除 2 取整