第1~3章C语言概述、算法、数据类型、运算符与表达式一、选择题ACDCBCCDCBD二、填空题1、n=202、a=66,b=E第4章顺序程序设计一、选择题BAAD二、程序阅读1、12240122、2,3,2,23、0三、编程1#includestdio.h#includemath.hvoidmain(){floata,b,c,s,area;scanf(%f,%f,%f,&a,&b,&c);s=(a+b+c)/2.0;area=sqrt(s*(s-a)*(s-b)*(s-c));printf(a=%f,b=%f,c=%f,area=%f,a,b,c,area);}2#includestdio.h#includemath.hvoidmain(){floata,b,c,del,x1,x2;scanf(%f,%f,%f,&a,&b,&c);del=b*b-4*a*c;if(del=0){x1=(-b+sqrt(del))/(2*a);x2=(-b-sqrt(del))/(2*a);printf(x1=%f,x2=%f,x1,x2);}elseprintf(没有实根);}3#includestdio.hvoidmain(){intc,f;c=26;f=9.0/5.0*c+32;printf(%d的华氏温度是%d,c,f);}第5章选择结构程序设计一、选择题DBBCDC二、程序阅读1、|a|+|b|=612、PQ3、-14、60~9060error!5、0,16、x+y+z=15三、编程1#includestdio.hvoidmain(){inta,b,c,min;scanf(%d,%d,%d,&a,&b,&c);min=a;if(minb)min=b;if(minc)min=c;}2#includestdio.hvoidmain(){inta;scanf(%d,&a);if(a%3==0&&a%5==0&&a%7==0)printf(yes);elseprintf(no);}3#includestdio.h#includemath.hvoidmain(){floatx,y;scanf(%f,&x);if(x0)y=fabs(x);elseif(x=0&&x=2)y=sqrt(x+1);elseif(x=2&&x4)y=pow(x+2,3);elsey=2*x+5;printf(x=%f,y=%f,x,y);}4#includestdio.hvoidmain(){floatrate,tax,salary;scanf(%f,salary);if(salary=850)rate=0;elseif(salary1350&&salary=2850)rate=0.1;elseif(salary2850&&salary5850)rate=0.15;elserate=0.2;tax=rate*(salary-850);printf(salary=%f,rate=%f,tax=%f,salary,rate,tax);}5#includestdio.hvoidmain(){inta,b,sum,n;scanf(%d,%d,a,b);sum=a*a+b*b;if(sum100){n=sum/100;printf(a*a+b*b=%d,n=%d,sum,n);}elseprintf(a*a+b*b=%d,sum);}第6章循环控制一、填空题:1、222、233、464、117二、选择题:1.C2.D3.B4.B5.B6.C7.C8.C9.B10.D三、程序阅读:1、输出:332、输出:243、2#4#7#11#16#4、3#2#0#0#1#5、B,A,D,C6、D,A,B,C7、B,C,A,D8、A,D,D,C9、C,C,A10、B,D,A11、A,D,C四、编程1.#includestdio.h#includemath.hvoidmain(){intx;printf(xsqrt(x)\n);for(x=5;x=1000;x++)printf(%d%f\n,x,sqrt(x));}2.#includestdio.h#includemath.hmain(){inti,flag;doublepi,item;i=1;flag=1;pi=0;item=1.0;while(fabs(item)=0.00001){item=flag*1.0/i;pi=pi+item;flag=-flag;i=i+2;}pi=pi*4;printf(pi=%f,pi);}3.教材126页例6.84.#includestdio.hmain(){inti,num1,num2,num3;num1=1;num2=1;printf(%d%d,num1,num2);for(i=3;i=10;i=i+1){num3=num1+num2;printf(%d,num3);num1=num2;num2=num3;}}第7章数组一、选择题:1.D2.D3.A4.C5.C6.C7.D8.B9.D10.B11.D12.D13.D14.A15.B二、程序阅读:1、A,B,B,D2、C,D,A,B3、B,B4、D,C,A5、C,D6、C,A7、1#2#3#1#1#38、298三、编程:1、#includestdio.hvoidmain(){intmark,a,p,f;a=p=f=0;printf(Enterscores:);scanf(%d,&mark);while(mark0){if(mark=85)a++;elseif(mark=60)p++;elsef++;scanf(%d,&mark);}printf(=85:%d\n,a);printf(60-84:%d\n,p);printf(60:%d\n,f);}2、#includestdio.hvoidmain(){inta[10],count=0,i;floataverage,sum=0;for(i=0;i10;i++){scanf(%d,&a[i]);sum=sum+a[i];}average=sum/10;for(i=0;i10;i++)if(a[i]average)count=count+1;printf(平均值为%f大于平均值的数有%d个,average,count);}3.#includestdio.hmain(){inta[10];inti,j,t,n;printf(“请输入一个正整数n(1n≤10):”);scanf(“%d”,&n);printf(“请输入数据:”);for(i=0;in;i++)scanf(%d,&a[i]);printf(\n);for(j=0;jn-1;j++)/*确定基准位置*/for(i=j+1;in;i++)if(a[j]a[i]){t=a[j];a[j]=a[i];a[i]=t;}printf(Thesortednumbers:\n);for(i=0;in;i++)printf(%d,a[i]);}4.#includestdio.hvoidmain(){inta[6][6],n,i,j,x,y,max;printf(“请输入一个正整数n(1≤n≤6):”);scanf(“%d”,&n);printf(“请输入一个n行n列的矩阵:\n”);for(i=0;in;i++)for(j=0;jn;j++)scanf(“%d”,&a[i][j]);max=a[0][0];x=0;y=0;for(i=0;in;i++)for(j=0;jn;j++)if(fabs(a[i][j])max){max=a[i][j];x=i;y=j;}printf(“绝对值最大的元素为:%d,下标分别为:%d,%d\n”,max,x,y);}第8章函数一、选择题(1)A(2)B(3)C(4)B(5)A(6)C(7)i.Bii.Diii.Aiv.D(8)i.Dii.Ciii.Biv.A(9)i.Dii.Biii.B(10)i.Cii.Ciii.Biv.B二、程序阅读题(1)3,5(2)4(3)s=18(4)5,25三、程序设计1#includestdio.h#includemath.hintisprime(intm){intk,n,res;if(m==1)return0;res=1;n=(int)sqrt(m);for(k=2;k=n;k++)if(m%k==0){res=0;break;}returnres;}voidmain(){intm,n;intsum=0;inti;do{printf(Inputm,nmnlike:3,10\n);scanf(%d,%d,&m,&n);}while(m0||n0||mn);for(i=m;i=n;i++){if(isprime(i)){sum+=i;}}printf(Theallprimes'sumis:%d\n,sum);}2intmax_value(intarr[][4]){inti,j,max;max=arr[0][0];for(i=0;i2;i++)for(j=0;j4;j++){if(maxa[i][j])max=a[i][j];}returnmax;}3#includestdio.h#includemath.hintisTheFineNumber(intn){intflag=0;inta,b,c;if((int)sqrt(n)==sqrt(n))//Íêȫƽ·½Êý{a=n%10;b=(n/10)%10;c=n/100;if(a==b||b==c||c==a)flag=1;}returnflag;}voidmain(){intn;inti;scanf(%d,&n);for(i=101;in;i++)if(isTheFineNumber(i))printf(%d\n,i);}第9章预处理命令CBBBDDDBC第10章指针一、选择题:1、D2、A3、D4、A5、D6、B7、C8、D9、B10、D11、A二、程序阅读题:1、C2、A3、B4、C5、A三、程序设计题:1#includestdio.hvoidmain(){voidswap(int*pointer1,int*pointer2);int*p1,*p2;inta=1,b=2;p1=&a;p2=&b;swap(p1,p2);printf(%d\n%d,a,b);}voidswap(int*p1,int*p2){inttemp;temp=*p1;*p1=*p2;*p2=temp;}2#includestdio.hvoidmain(){inta[10],*p1,i,j,temp;p1=a;for(i=0;i10;i++)scanf(%d,p1+i);for(i=0;i10;i++){p1=a;for(j=0;j10-i;j++,p1++)if(*p1*(p1+1)){temp=*p1;*p1=*(p1+1);*(p1+1)=temp;}}p1=a;for(i=0;i10;i++,p1++)printf(%d,*p1);}3#includestdio.hvoidmain(){intupper=0,lower=0,digit=0,space=0,other=0,i=0;char*p,s[20];printf(inputstring:);while((s[i]=getchar())!='\n')i++;p=&s[0];while(*p!='\n'){if(('A'=*p)&&(*p='Z'))++upper;elseif(('a'=*p)&&(*p='z'))++lower;elseif(*p=='')++space;elseif(('0'=*p)&&(*p='9'))++digit;else++other;p++;}pri