最新二级C(不要传,必须)

上传人:飞*** 文档编号:39936120 上传时间:2018-05-21 格式:DOC 页数:127 大小:1.51MB
返回 下载 相关 举报
最新二级C(不要传,必须)_第1页
第1页 / 共127页
最新二级C(不要传,必须)_第2页
第2页 / 共127页
最新二级C(不要传,必须)_第3页
第3页 / 共127页
最新二级C(不要传,必须)_第4页
第4页 / 共127页
最新二级C(不要传,必须)_第5页
第5页 / 共127页
点击查看更多>>
资源描述

《最新二级C(不要传,必须)》由会员分享,可在线阅读,更多相关《最新二级C(不要传,必须)(127页珍藏版)》请在金锄头文库上搜索。

1、校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场1校园网新视野教育二级 C 上机考试复习资料 V16.0(共 50 套题目)第 1 套 校园网新视野教育上机考试复习资料 1、程序填空题 #include #include double fun(double x) double f, t; int n;f = 1.0 + x; /*found*/t = _x_;n = 1;do n+; /*found*/t *= (-1.0)*x/_n_;f += t; /*found*/while (_fabs(t)_ = 1e-6);return f; main

2、() double x, y;x=2.5;y = fun(x);printf(“nThe result is :n“);printf(“x=%-12.6f y=%-12.6fn“, x, y); 校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场22、程序修改题 校园网新视野教育上机考试复习资料#include long fun(int x,int y,long *p ) int i;long t=1; /*found*/for(i=1; i #include double fun(double x) int i=0;double s=1,a=1;w

3、hile(fabs(a)0.000001)a=a*(0.5-i)*x/(i+1);s+=a;校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场3i+;return s; main() double x,s;printf(“Input x: “); scanf(“%lf“,s=fun(x);printf(“s=%fn“,s); 第 2 套 校园网新视野教育上机考试复习资料 1、程序填空题 #include int c1,c2,c3; void fun(long n) c1 = c2 = c3 = 0;while (n) /*found*/switch(

4、_n%10_) /*found*/case 1: c1+;_break_; /*found*/case 2: c2+;_ break_;case 3: c3+;n /= 10; main() long n=123114350L;fun(n);printf(“nThe result :n“);printf(“n=%ld c1=%d c2=%d c3=%dn“,n,c1,c2,c3);校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场42、程序修改题 校园网新视野教育上机考试复习资料#include int fun(unsigned n, int *ze

5、ro) int count=0,max=0,t;do t=n%10; /*found*/if(t=0)count+;if(max double fun(int n) 校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场5int i;double s=0,a=1;for(i=1;i unsigned long fun(unsigned long n) unsigned long x=0; int t;while(n) t=n%10; /*found*/if(t%2=_0_) /*found*/x=_10*x_+t; /*found*/n=_n/10_;r

6、eturn x; main() unsigned long n=-1;校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场6while(n99999999|nvoid fun (long s, long *t) int d;long sl=1; /*found*/*t = 0;while ( s 0) d = s%10; /*found*/if (d%2 != 0) *t = d * sl + *t; sl *= 10;s /= 10; main() long s, t;printf(“nPlease enter s:“); scanf(“%ld“,

7、fun(s, printf(“The result is: %ldn“, t); 3、程序设计题 校园网新视野教育上机考试复习资料校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场7#include void fun(char p1, char p2) while(*p1) p1+;while(*p2)*p1=*p2;p1+;p2+;*p1=0;main()printf(“Enter s1 and s2:n“) ;scanf(“%s%s“, s1, s2) ;printf(“s1=%sn“, s1) ;printf(“s2=%sn“, s2) ;pr

8、intf(“Invoke fun(s1,s2):n“) ;fun(s1, s2) ;printf(“After invoking:n“) ;printf(“%sn“, s1) ; 第 4 套 校园网新视野教育上机考试复习资料 1、程序填空题 校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场8#include #define M 3 #define N 4 void fun(int (*a)N) int i=0,j,find=0,rmax,c,k;while( (idouble fun ( int m ) double y = 1.0 ;int i

9、; /*found*/for(i = 2 ; i #include int fun(int score, int m, int below) int i=0,s=0,n=0;for(i=0;i #include #define N 5 #define M 10 /*found*/ void fun(char (*ss) _M_, int k) int i=0 ; /*found*/while(i #include double fun(double eps) double s,t; int n=1;s=0.0; /*found*/t=0; t=1;while( teps) s+=t;t=t *

10、 n/(2*n+1);n+; /*found*/return(2*s); main() double x;printf(“nPlease enter a precision: “); scanf(“%lf“,printf(“neps=%lf, Pi=%lfnn“,x,fun(x); 3、程序设计题 校园网新视野教育上机考试复习资料校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场12#include void fun( char *a, int n ) /* 以下代码仅供参考 */int i=0,j,k=0;while(ak=*) k+; /* k

11、为统计*字符个数 */if(kn)i=n;j=k;/* 以下完成将下标为 k 至串尾的字符前移 k-n 个位置 */while(aj)ai=aj;i+;j+;ai=0; main()printf(“Enter a string:n“);gets(s);printf(“Enter n : “);scanf(“%d“,fun( s,n );printf(“The string after deleted:n“);puts(s); 第 6 套 校园网新视野教育上机考试复习资料 1、程序填空题 校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场13#incl

12、ude #define N 4 /*found*/ void fun(int (*t)_N_ ) int i, j;for(i=1; i #include #include /*found*/ #define FU(m,n) (m/n)gai(m)/(n) float fun(float a,float b,float c) float value;value=FU(a+b,a-b)+FU(c+b,c-b); /*found*/r Return(Value); main() float x,y,z,sum;printf(“Input x y z: “);scanf(“%f%f%f“,print

13、f(“x=%f,y=%f,z=%fn“,x,y,z);if (x=y|y=z)printf(“Data error!n“);exit(0);sum=fun(x,y,z);printf(“The result is : %5.2fn“,sum); 3、程序设计题 校园网新视野教育上机考试复习资料#include void fun( char *a ) int i=0,j=0;while(ai=*) i+;while(ai)aj=ai;i+;j+;校园网新视野教育二级 C 上机考试复习资料 V16.0()本资料仅供考前复习使用,请勿带入考场15aj=0;main() char s81;printf(“Enter a string:n“);gets(s);fun( s );printf(“The string after deleted:n“);p

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号