福建省c语言模拟试题及答案

上传人:第*** 文档编号:33885448 上传时间:2018-02-18 格式:DOC 页数:17 大小:252KB
返回 下载 相关 举报
福建省c语言模拟试题及答案_第1页
第1页 / 共17页
福建省c语言模拟试题及答案_第2页
第2页 / 共17页
福建省c语言模拟试题及答案_第3页
第3页 / 共17页
福建省c语言模拟试题及答案_第4页
第4页 / 共17页
福建省c语言模拟试题及答案_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《福建省c语言模拟试题及答案》由会员分享,可在线阅读,更多相关《福建省c语言模拟试题及答案(17页珍藏版)》请在金锄头文库上搜索。

1、1C20111225 大题答案#include void main() long f=/*/ 1 /*/;int i;for (i=1;ivoid main()int p,q,r;float f;clrscr();printf(Please input p q :);scanf(%d%d,/*/ f=1.0*p/q;r= (int)/*/ f*10 /*/%10;printf(n p/q=%f The first decimal place is: %dn,f,r);getch();#include #include double f(double /*/ x /*/)return (x*x*

2、x+1.3*x*x+1.1*x-1.2);void main()float x,x1,x2;double y,y1,y2;doprintf(Input x1,x2:);2scanf(%f,%f,y1=f(x1); y2=f(x2);while(y1*y2=0);do x=(x1+x2)/2;y=/*/ f /*/ (x);y1=f(x1);if(y*y10)x1=x;elsex2=/*/ x /*/;while(fabs(y)=1e-6);printf(Root of Equation is %8.3fn,x);getch();#include #include void main()char

3、 s20;int i;printf(Please input a string:);scanf(/*/ “%s” /*/,s );i=0;while(si)si=/*/ si3; /*/*/ i+ ; /*/printf(n Target string: %sn, s);getch();#include void main() int i,n;/*/ n=0 /*/;for(i=1;i#include void sort(int a, int n) int i, j, k, temp;for( i = 0; i #include/*/ /*/double f(double x)double y

4、;4y=/*/ 7.7*x*x+10.3*x+6.6 /*/;return (y); void main()double x,y1,y2;printf(Please input x:);scanf(%lf,y1=f(/*/ x+1.1 /*/);y2=f(sin(x);printf(nf(x+1.1)=%.3lf,y1);printf(nf(sinx)=%.3lf,y2);getch();#include #include int count(/*/ char s /*/)int n=0;char *p=/*/ s /*/; while(*p) if(*p=a) n+;/*/ p+ /*/;r

5、eturn n; void main()char s255;printf(Enter a string:);gets(s);printf(Count of a is:%dn,count(s);getch();#includestdio.h#define ROW 3#define COL 4void main()5int aROWCOL=2,11,3,5,7,24,8,9,16,10,18,66;int bROWCOL=1,9,5,12,6,11,13,2,15,7,25,56; int c/*/ROW /*/COL,i,j;for(i=0;iunsigned long fun(unsigned

6、 long n)unsigned long x=0;int t=0;while(n) t=n%10;if(t%2=/*/ 1 /*/)x=/*/ 10*x /*/+t;n=n/10;return x; void main()unsigned long n=-1;while(n99999999|nvoid main()6int a,b,temp;printf(a,b=);scanf(%d,%d,if(ab)if(/*/ (a%2) /*/) /*改: ! (a%2) 或改:a%2=0*/printf(%5d,a);getch();#include /*/void fun(int n)/*/ 改:

7、double fun(int n) double y = 0.0;int a=2,b=1,c,k;for(k=1;kvoid main()7/*/ int a=10; num,mark; /*/ 改:int a=10, num,mark;char op,es;printf(Input an Expression: a);scanf(%c%c%d,mark=0;if(es=)/*/ swich /*/(op) 改:switchcase +: a=a+num; break;case -: a=a-num; break;case *:a=a*num; break;case /:if(num) a=a

8、/num ;else mark=1;break;default:mark=1;elsemark=1;if(!mark)printf(a=%dn,a);elseprintf(Error!n);getch();#include int fun(int *x,int y) int t;t=*x;/*/ x=y; /*/ 改:*x=y;/*/ return(y); /*/ 改:return(t);void main() int x=6,y=8;printf(%d,%dn,x,y);y=fun(8printf(%d,%dn,x,y);getch();#include #include void main

9、()/*/ character str100; /*/ 改: char str100;int number,u_letter,l_letter,i;number =u_letter =l_letter=0;printf(Please input string:);gets(str);/*/ i=1; /*/ 改: i=0;while(stri) if (stri=0 & stri=A | stri=A &stri=n & stri#include void main() char s20=international 51,t20;char tab52=c,h,i,a,a,b,e,g,l,p;i

10、nt i,j=0;/*/ strcmp(t,s); /*/ 改:strcpy(t,s);while(tj) for(i=0;/*/ ivoid main()/*/ int i=1,n=1; /*/ 改:int i=1,n=0;doif(i%3=2 & /*/ i%5=3 /*/) 改:i%5=3printf(%5d,i);n+;if(!(n%5)printf(n);i+;/*/ while(ivoid fun(char *p,char *b) int i,k=0;while(*p) i=1;while(ivoid main()/*/ int n,i,bk; /*/ 改:int n,i,bk,j

11、;printf(Input a num(1-9):);scanf(%d,for(i=1;ivoid main() int r,m,n,p,q;printf(Enter m,n: );scanf(%d,%d,p=m; q=n;/*/ r=m/n; /*/ 改: r=m%n; while(/*/ r=0 /*/) 改:r 或 r!=0 m=n;n=r;r=m%n; printf(gcd(%d,%d)=%d n,p,q,n);getch();#include #include double fun(double x,double y) /*/return (7.7*x+6.9*y)/(fabs(2.

12、3*y+1.3*x);/*/ void main() printf(fun(1.1,0.2) = %6.3lfn, fun(1.1,0.2); 12getch();#include int fun(int x,int a,int n,int b,int c) /*/ int i,k,nb=0,t;for (i=0;ix) cnb=bnb=ai;nb+;for (i=0;i#include double fun1(double x) /*/return (7.8-sin(x)/(exp(x)+0.3);/*/ void main() printf(fun1(2.5) = %6.3lfn, fun

13、1(2.5); getch();#include #include void fun(char *s,char t) /*/int i,j=0for (i=0;si;i+)if (i%2tj=0;/*/void main()char s100,t100;printf(nPlease enter string s: );scanf(%s,s);fun(s,t);printf(nThe result is:%sn,t);getch();14#include #include double fun(float x) /*/double y;if (x2) y=cos(x);return y;/*/void main() float x;printf(Please input a number:);scanf(%f,printf(fun(%.2f)=%.2lfn,x,fun(x);getch();#include #include void fun(int a,int b,long *c) /*/int x1,x2,x3,x4;x1=a/10;x2=a%10;x3=b/10;x4=b%10;*c=100

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

当前位置:首页 > 办公文档 > 解决方案

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