1、1第二部分:改错题第一套卷:cmody011.c#include #include #include #include void main() char str1100, t200;int i, j;/*/ i = 0; /*/ j=0clrscr();strcpy(str1, “4AZ18c?Ge9a0z!“);for (i = 0; i#include #include #include 2#define M 50double fun(int n) double y = 0.0;int i,j;j=0;for(i=1;i+)/*/ if(i10) /*/ y+=1.0/i; j+;if(j
2、=n) break;return y;void main() clrscr();printf(“fun(8) = %8.3lfn“, fun(8);*第二套卷*cmody021.c#include void main()/*/ int i; j; /*/ int i, j;(概念错误 )for (i=1;i#include 3/*/int fun();/*/ int fun()(概念错误) int hen,cock,chicken,n=0;clrscr();for(cock=0;cockhen:%d,cock:%d,chicken:%dn“,n,hen,cock,chicken);if(n=2
3、0) getch(); return n;void main() int num;num=fun();printf(“n There are %d solutions.n“,num);getch(); 第三套卷*cmody031.c#include #include void main() int m,n,result,flag=0;/*/ char ch, /*/ char ch;(概念错误)clrscr();printf(“Input an expression: “);scanf(“%d%c%d“,/*/ switch ch /*/ switch (ch) case +: result=
4、m+n; break;case -: result=m-n; break;case *: result=m*n; break;case %: result=m%n; break;case /: result=m/n; break;default: printf(“Error!n“); flag=1; if (!flag) printf(“%d %c %d = %dn“,m,ch,n,result);getch();*cmody032.c#include 4#include void main() int num;printf(“n“);num=fun();printf(“nThe total
5、of prime is %d“,num);getch(); int fun() int m,i,k,n=0;for(m=201; m=k) printf(“%-4d“,m);n+;if(n%10=0) printf(“n“);return n;模拟卷*evsum.c#include void main()/*/ int sum=1,i; /*/ int sum=0,ifor(i=100; i1; i-)/*/ if(i%2=0) sum+=i; /*/ if(i%2=0) sum+=i;printf(“%dn“,sum);*dafsum.c#include void main() int i,
6、a,b,c;/*/ for(i=100;i=999;i+) /*/ for(i=100;i#include void main()int x;/*/ float f ; /*/printf(“Input an integer: “);scanf(“%d“,f = /*/ (fabs(x)-2)/(x*x+1) /*/ ;printf(“F(x)=%fn“,f);*ccon012.c#include void main() double pi=0;long i, sign=1;for(i=1;i#include 6int max,min;void find_max_min(int *p,int
7、n)int *q;max=min=*p;for(q=p; q*q) min=*q;void main()int i,num10;printf(“Input 10 numbers: “);for(i=0;ivoid main()int a,b,k;int plu = /*/ 403 /*/;根据题义for(a=1; avoid main()int n,a,b;/*/ 7a=0,b=0/*/scanf(“%d“,while(/*/ n /*/)if(n0) a+;else /*/ b+; /*/scanf(“%d“,printf(“Positive integer: %d, negative in
8、teger: %dn“,a,b);*ccon023.c#include #include int prime(int n) int k,flag=1;for(k=2; k#include /*/ main() /*/ float x,x0,f,f1;x=1.5;8do x0=x;f=(2*x0-4)*x0+3)*x0-6;f1=(6*x0-8)*x0+3;x=x0-f/f1;/*/ while /*/(fabs(x-x0)=1e-6);printf(“the root is: %.2fn“,x);*ccon032.c#include void main() char s80;int i;pri
9、ntf(“Please input a string: “);for(i=0;(si=getchar()!=n)/*/ float avg=0; /*/for(k=0;k#include void main()int x;/*/ float f; /*/printf(“Input an integer: “);scanf(“%d“,f = /*/ (abs(x)-2.0)/(x*x+1.0) /*/ ;printf(“F(x)=%fn“,f);getch();*intsum.c#include void main()int n,a,b;/*/a=0; b=0;/*/scanf(“%d“,while(/*/n /*/)if(n%2=0) a+=n;/*/ else b+=n /*/scanf(“%d“,printf(“Sum of even number: %d, Sum of odd number: %dn“,a,b);*fac.c#include void main() int n,i;double s,fac;/*/ s=0; fac=1; /*/scanf(“%d“,for(i=1;i=n;i+)10fac=/*/ fac/i /*/;s=s+fac;printf(“%fn“,s);*