




已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1.答案见1.c#include #include #define ROW 4#define COL 4#define LEN 12int fun(int aCOL,int b) /*/Int i,j,t,k=0,sum=0;For(i=0;iROW;i+) For(j=0;jCOL;j+) If(aij=0) for(t=j+1;tCOL;t+) If(ait0) bk=ait;sum+=bk;k+;Return sum; /*/void main() int arraROWCOL=-2,0,-3,-1,-8,2,0,-4,0,3,-3,-12,21,0,-13,3; int arrbLEN,i,result; for(i=0;iLEN;i+) arrbi=0; clrscr(); result=fun(arra,arrb); printf(array arrb is:n); for(i=0;iLEN;i+) if(arrbi=0) printf( ); else printf(%4d,arrbi); printf(nresult=%d,result); getch();2.答案见2.c#include #include void fun(int arr,double x,int y) /*/double z;z=(y+2)*pow(x,y)arr0=(int)z;arr1=(int)(z*100)%100;/*/void main() int y; double x; int arra2; printf(Please enter x(1x2),y(0y1.0 &x0 & y=6) fun(arra,x,y); printf(npart1=%d,part2=%d,arra0,arra1); else printf(x or y is out of range!); getch();3.答案见3.c#include #define ROW 9int fun(int a) /*/int i,j,t;for(i=0;iROW-1;i+) for(j=0;jROW-1;j+) if(aiai+1;t=ai;ai=ai+1;ai+1 =t /*/void main() int arraROW=45,58,33,24,40,20,30,28,31; int max_pre,i; max_pre=fun(arra); printf(array arra is:); for(i=0;iROW;i+) printf(%d ,arrai); printf(nmax_pre is %d,max_pre); getch(); 4.答案见4.c#include #include void main() double x; int n; double fun(double x,int n); printf(Please enter x,n:n); scanf(%lf%d,&x,&n); printf(fun=%lfn,fun(x,n); getch();double fun(double x,int n)/*/double y;if(n=1)y=x; else if(n1) y=(x+1)*fun(x,n-1); return y;/*/5.答案见5.c#include #define N 5#define M 8void fun(int a,int b,int c) /*/Int i, j, k ;For(i=0;iN;i+) ci=ai;For(j=0;jM;j+) cN+j=bj;For(i=0;iN+M-1;i+) For(j=0;jN+M-1;j+) If(cjcj+1) k=cj;cj=cj+1;cj+1=k; /*/void main() int arraN=5,10,15,27,46,arrbM=50,45,42,29,15,8,5,2; int arrcN+M,k; fun(arra,arrb,arrc); printf(array arra is:); for(k=0;kN;k+) printf(%d ,arrak); printf(narray arrb is:); for(k=0;kM;k+) printf(%d ,arrbk); printf(nresult arrc is:); for(k=0;kN+M;k+) printf(%d ,arrck); getch();6.答案见6.c#include #include double fun(float x) /*/float yIf(x=0 & x=500 & x=2000&x=5000) y=44;Return y;/*/void main() float x; double y; clrscr(); printf(Please input a number:n); scanf(%f,&x); y = fun(x); printf(f(%.2f)=%.2fn,x,y); getch();7.答案见7.c#include #include double fun(float x) /*/Double y;If(x10) y=1/(1-exp(-x);else If(x=10) y=(x+3)*sin(2*x);return y;/*/void main() float x; double y; printf(Please input a number:n); scanf(%f,&x); y = fun(x); printf(f(%.3f)=%.3fn,x,y); getch();8.答案见8.c#include int fun(char *str1, char *str2) /*/int n=0,m=0;int char*p1,char*p2;for(p1=str1;*p!1=0;*p1+)if(*p1=a&*p1=a&*p20) printf(Numbers of Lower char in %s Numbers of Lower char in %s,str1,str2); if(rela=0) printf(Numbers of Lower char in %s = Numbers of Lower char in %s,str1,str2); if(rela0) printf(Numbers of Lower char in %s Numbers of Lower char in %s,str1,str2); getch();9.答案见9.c#include #include double fun(float x) /*/double y;if(x=10) y=log(3*x);else if(x=1 & x10) y=sqrt(2*x-1);else if(x1) y=fabs(x);return y; /*/void main() float x; double y; clrscr(); printf(Please input a number:n); scanf(%f,&x); y = fun(x); printf(f(%.2f)=%.2fn,x,y); getch();10.答案见10.c#include void main() double
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 公司职业鉴定活动方案
- 公司新年拍照策划方案
- 公司献血公益活动策划方案
- 公司种植绿植活动方案
- 公司特卖现场活动方案
- 公司电商短视频策划方案
- 公司温泉度假活动方案
- 公司腊八节慰问活动方案
- 公司水枪大战活动方案
- 公司相亲会会活动方案
- 新教材人教a版选择性必修第三册8.1成对数据的统计相关性课件2
- 芬顿试剂投加量计算
- 精选《机械制图》期末考试题库388题(含答案)
- 2023年山西万家寨水务控股集团有限公司招聘笔试题库及答案解析
- 数码照片档案管理夏2014
- GB/T 19249-2003反渗透水处理设备
- 2023年德阳市旌阳区广播电视台(融媒体中心)招聘笔试题库及答案解析
- 小学生职业生涯规划启蒙课件PPT
- 钻井安全操作规范
- 食用菌生产技术 大球盖菇栽培技术课件
- 花城版小学二年级音乐(下)全册教案
评论
0/150
提交评论