ImageVerifierCode 换一换
格式:DOCX , 页数:23 ,大小:171.81KB ,
资源ID:8019968      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8019968.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言考试大题答案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言考试大题答案.docx

1、C语言考试大题答案C20111225大题答案#include void main() long f=/*/ 1 /*/; int i; for (i=1;i=13;/*/ i=i+2 /*/) f=f*i; printf(nf=%ld, f); getch(); #includevoid main() int p,q,r; float f; clrscr(); printf(Please input p q :); scanf(%d%d,/*/ &p,&q /*/); f=1.0*p/q; r= (int)/*/ f*10 /*/%10; printf(n p/q=%f The first d

2、ecimal place is: %dn,f,r); getch();#include #include double f(double /*/ x /*/)return (x*x*x+1.3*x*x+1.1*x-1.2);void main()float x,x1,x2; double y,y1,y2; do printf(Input x1,x2:); scanf(%f,%f,&x1,&x2); 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; else

3、 x2=/*/ x /*/; while(fabs(y)=1e-6); printf(Root of Equation is %8.3fn,x); getch();#include #include void main() char 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;

4、 /*/ n=0 /*/; for(i=1;i=/*/ 1000 /*/ ;i+) if( (i%3=0 | i %7=0) & ( i% /*/ 10 /*/ =3 ) ) printf(%5d,i); n+; if(n%6=0) printf(n); getch();#include #include void sort(int a, int n) int i, j, k, temp; for( i = 0; i n-1; i+ ) k = i; for(/*/ j=i+1 /*/; j n; j+) if(/*/ akaj /*/) k=j; if( k != i ) temp=/*/

5、ak /*/; ak=ai; ai=temp; void main() int a = 50,25,88,32,2,65,7,64; int i,n = sizeof(a)/sizeof(int); sort(a,n); for(i=0;in;i+) printf(%d ,ai); printf(n); getch();#include#include/*/ /*/double f(double x)double y; y=/*/ 7.7*x*x+10.3*x+6.6 /*/; return (y); void main()double x,y1,y2; printf(Please input

6、 x:); scanf(%lf,&x); 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+ /*/; return n; void main() char s255; printf(Enter a string:); gets(s); printf(

7、Count of a is:%dn,count(s); getch();#includestdio.h#define ROW 3#define COL 4void main()int 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;iROW;i+) for(j=0;jCOL;j+) cij=/*/ aij-bij; /*/ for(i=0;iROW;i+) for(j=0;j/*/ COL /*/;j+) print

8、f(%5d,cij); printf(n); getch();#include unsigned long fun(unsigned 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|n0) printf(Please input(0n1000000000):); scanf(%ld,&n); printf(nThe result is:%

9、ldn,fun(n); getch();#include void main()int a,b,temp; printf(a,b=); scanf(%d,%d,&a,&b); if(ab) if(/*/ (a%2) /*/) /*改: !(a%2) 或改:a%2=0*/ printf(%5d,a); getch();#include /*/void fun(int n)/*/ 改:double fun(int n) double y = 0.0; int a=2,b=1,c,k; for(k=1;k=n;k+) /*/ y+=(Double)a/b; /*/ 改: y+=(double)a/b

10、; c=a; /*/ a=b /*/; 改: a=a+b b=c; return y;void main() printf(fun(5) = %lfn, fun(5); getch();#include void main()/*/ int a=10; num,mark; /*/ 改:int a=10, num,mark; char op,es; printf(Input an Expression: a); scanf(%c%c%d,&op,&es,&num); mark=0; if(es=) /*/ swich /*/(op) 改:switch case +: a=a+num; break

11、; case -: a=a-num; break; case *: a=a*num; break; case /: if(num) a=a/num ; else mark=1; break; default: mark=1; else mark=1; if(!mark) printf(a=%dn,a); else printf(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=

12、8; printf(%d,%dn,x,y); y=fun(&x,y); printf(%d,%dn,x,y); getch();#include #include void main()/*/ 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 &

13、stri=n & stri=z) l_letter+; i+; printf(number=%d,u_letter=%d,l_letter=%dn,number,u_letter,l_letter); getch();#include #include void main() char s20=international 51,t20; char tab52=c,h,i,a,a,b,e,g,l,p; int i,j=0;/*/ strcmp(t,s); /*/ 改:strcpy(t,s); while(tj) for(i=0;/*/ i=3 /*/;i+) 改:i=5 if(tj=tabi0)

14、 /*/ tj=tabi; /*/ 改:tj=tabi1; break; j+; printf(nThe soure string: %sn,s); printf(nThe target string: %sn,t); getch();#include void main()/*/ int i=1,n=1; /*/ 改:int i=1,n=0; do if(i%3=2 & /*/ i%5=3 /*/) 改:i%5=3 printf(%5d,i); n+; if(!(n%5) printf(n); i+; /*/ while(i1000) /*/ 改:while(i1000); getch();

15、#include void fun(char *p,char *b) int i,k=0; while(*p) i=1; while(i=4&*p) /*/ bk=p; /*/ 改:bk=*p; k+; p+; i+; if(*p) /*/ bk+= ; /*/ 改:bk+=32; bk=0;void main() char a80,b80; printf(Enter a string:); gets(a); printf(The original string:); puts(a); fun(a,b); printf(nThe string after insert space:); put

16、s(b); printf(n); getch();#include void main()/*/ int n,i,bk; /*/ 改:int n,i,bk,j; printf(Input a num(1-9):); scanf(%d,&n); for(i=1;i=n;i+) for(bk=1;bk=n;bk+) printf( ); for(j=1;/*/ j=i+1 /*/;j+) 改: j=i printf(%d,i); printf(n); for(i=1;i=n;i+) for(bk=1;bk=i;bk+) printf( ); for(j=1;j=n-i+1;j+) printf(%

17、d,n-i+1); printf(/*/ /n /*/); getch();#include void main() int r,m,n,p,q; printf(Enter m,n: ); scanf(%d,%d,&m,&n); 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+

18、6.9*y)/(fabs(2.3*y+1.3*x); /*/ void main() printf(fun(1.1,0.2) = %6.3lfn, fun(1.1,0.2); getch();#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;inb-1;i+)for (k=i+1;knb;k+)if (cick) t=ci;ci=ck;ck=t;return nb; /*/ void main() int n=10,i,x,nb; int

19、 aa10=32, -5, -31, -10, 25, 50, 12, 15, -16, 18; int bb10,cc10; clrscr(); printf(Please input x:); scanf(%d,&x); printf(Count of array aa:%3dn,n); printf(Element of array aa:); for(i=0;in; i+) printf(%5d,aai); printf(n); nb=fun(x,aa,n,bb,cc); printf(Element of array bb:); for(i=0;inb;i+) printf(%5d,

20、bbi); printf(n); printf(Element of array cc:); for(i=0;inb;i+) printf(%5d,cci); printf(n); printf(Count of array bb:%3dn,nb); getch();#include #include double fun1(double x) /*/return (7.8-sin(x)/(exp(x)+0.3); /*/ void main() printf(fun1(2.5) = %6.3lfn, fun1(2.5); getch();#include #include void fun(

21、char *s,char t) /*/int i,j=0for (i=0;si;i+)if (i%2&si%2) tj+=si;tj=0; /*/void main() char s100,t100; printf(nPlease enter string s: ); scanf(%s,s); fun(s,t); printf(nThe result is:%sn,t); getch();#include #include double fun(float x) /*/double y;if (x2) y=cos(x);return y; /*/void main() float x; pri

22、ntf(Please input a number:); scanf(%f,&x); 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=1000*x4+100*x2+10*x3+x1 /*/void main() int a,b; long c; printf(Input a,b: ); scanf(%d,%d,&a,&b); fun(a,b,&c); pri

23、ntf(The result is:%ld,c); getch();#include #include double fun(float x) /*/double y;if (x5) y=x*x-10.2;return y /*/void main() float x; printf(Please input a number:); scanf(%f,&x); printf(fun(%.2f)=%.2lfn,x,fun(x); getch();#include float fun(int n) /*/float s=0,p=0;int i;for(i=1;i=n;i+)p+=2*i-1;s+=

24、i/p;return s; /*/void main() int n; float s; printf(Please enter n=); scanf(%d,&n); s=fun(n); printf(nThe result is:%.3f,s); getch();#include #include double fun(double x) /*/double y;y=1.0/2*(2.3*x+(4.6-x)/(x+6.2);return y; /*/ void main() printf(fun(1.6) = %6.3lfn, fun(1.6); getch();#include #define N 3void fun(int aNN,int n) /*/for(i=0; iN; i+

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1