C语言答案参考

上传人:缘*** 文档编号:333289099 上传时间:2022-09-01 格式:PDF 页数:50 大小:2.41MB
返回 下载 相关 举报
C语言答案参考_第1页
第1页 / 共50页
C语言答案参考_第2页
第2页 / 共50页
C语言答案参考_第3页
第3页 / 共50页
C语言答案参考_第4页
第4页 / 共50页
C语言答案参考_第5页
第5页 / 共50页
点击查看更多>>
资源描述

《C语言答案参考》由会员分享,可在线阅读,更多相关《C语言答案参考(50页珍藏版)》请在金锄头文库上搜索。

1、C语言答案参考First questions,m personal results stored in the score array,please write the function fun,its function is:lower than theaverage person as a function value returned,will be less thanthe average score placed in the below specified function.Answer:Int fun(int,score,int,m,int,below)(Int,I,k=0,av

2、er=0;For(i=0;I m;i+)Aver+=scorei;Aver/=m;For(i=0;I m;i+)If(scorei aver)(B elowk=scorei;K+;Return k;2:second questions please write the function fun,its functionis:1 to 100 can be obtained 7 North or divisible by 11,butall the certificate is not divisible by 11 and 7 at the north,and put them in the

3、array pointed to by a,returns the numberof these numbers by n.Answer:Void fun(int,*a,int,*n)(Int,I,j=0;For(i=2;I 1000;i+)(if(i%7=0|i%ll=0)&i%77!=0)Aj+=i;*n=j;)Please write the function void 3:third fun(int x,int pp,int*n),its function is to calculate the integers:X and isnot even,and the array on th

4、e PP referred to the order fromsmall to large,the divisor of the number returned through theparameter n.Answer:Void,fun(int,x,int,pp,int,*n)(Int,i=l,j=0,k=0,*t=pp;For(i=0;I =x;i+)If(i%2,=0)(Tj=I;J+;For(i=0;I J;i+)If(x%t i=0)Ppk=ti;K+;*n=k;4:fourth questions,please write a function void fun(char*tt,i

5、nt pp),statistics in the TT characters,a to Z 26letters appear in the number of times,and in turn placed inthe PP refers to the array.Answer:Void fun(char,*tt,int,pp)Int i;For(i=0;I 26;i+)Ppi=0;While(*tt)Switch(*tt)Ca s e a:p p O+;b r e a k;Ca s e B:p p l +;b r e a k;Ca s e C:p p +;b r e a k;Ca s e

6、d:p p 3+;b r e a k;Ca s e e :p p 4+;b r e a k;Ca s e f :p p 5+;b r e a k;Ca s e g:p p 6+;b r e a k;Ca s e H:p p 7+;b r e a k;Ca s e I:p p 8+;b r e a k;Ca s e J:p p 9+;b r e a k;Ca s e k :p p 10+;b r e a k;Ca s e 1:p p l l +;b r e a k;Ca s e m:p p 12+;b r e a k;Ca s e n :p p 12+;b r e a k;Case o:pp14

7、+;break;Case p:pp15+;break;Case Q:pp16+;break;Case R:pp17+;break;Case s:pp18+;break;Case t :pp19+;break;Case U :pp20+;break;Case V:pp21+;break;Case W:pp22+;break;Case x:pp23+;break;Case y:pp24+;break;Case Z:pp25+;break;)Tt+;5:fifth questions,please write a function void fun(int,m,int,K,int,xx),the f

8、unction of this function is:will begreater than the integer m and close to the M K,the prime valuesstored in the XX refers to the array.Answer:Void fun(int,m,int,K,int,xx口)(Int,g=0,I,J,flag=l;For(i=m+l;I m*m;i+)(For(j=0;J=i)(If(k=0)(Xxg+=i;K;)ElseBreak;6:sixth questions,please write a function void

9、fun(char,a口,char,int,n),its function is:delete characters in eachstring specified subscript.Where a points to the originalstring,the deleted string is stored in the array referred toby B,and the specified subscript is stored in the n.Answer:Void fun(char,a,char,b,int,n)(Int,I,j=0;For(i=0;I LEN;i+)If

10、(I,=n)(B j=ai;J+;)B j=,0;7:seventh questions,please write a function int fun(int,*s,int,t,int,*k),used to find the largest element in the arrayexcept the index in the array,and stored in the K refers tothe storage unit.Answer:Void fun(int,*s,int,t,int,*k)(Int,I,max;Max=s0;For(i=0;I max)(Max=si;*k=I;

11、)8:eighth,write function fun,function is:according to thefollowing offensive calculation s,the results of thecalculation as a function value to return;N through theparameters of the incoming.S=l+1/(1+2)+1/(1+2+3)+.+1/(1+2+3+4+.+n)Answer:Float fun(int n)(Int i;Float,s=l.0,t=l.0;For(i=2;I n.P=m!/n!(m-

12、n)!Answer:Float fun(int,m,int,n)(Float,P,t=l.0;Int I;For(i=l;I =m;i+)T=t*I;P=t;For(t=l.0,i=l;I =n;i+)T=t*I;P=p/t;For(t=l.0,i=l;I le-6);Return xl;11:eleventh questions.The following procedure defines a n*n two-dimensional array,And automatically assign in the main function.Please write thefunction fu

13、n(int an).The function of this function is tomake the values in the lower left triangle of the array all setto 0.Answer:Int fun(int a N)(Int,I,j;For(i=0;I N;i+)For(j=0;J =1;j+)Ai j=0;12:twelfth questions,the following procedures define the n*n two-dimensional array,and in the main function assignmen

14、t.Please write the function fun,function function,so that theaverage value of the array peripheral elements,and as afunction value returned to the main function of the s.Answer:Double fun(int w N)(Int,I,J,k=0;Double s=0.0;For(j=0;J N;j+)(S+=w0 j;K+;For(j=0;J N;j+)S+=wN-lj;K+;For(i=l;I =N-2;i+)(S+=wi

15、 0;K+;For(i=l;I =N-2;i+)(S+=wi N-l;K+;Return s/=k;13:t h i r t e e n t h q u e s t i o n s,p l e a s e w r i t e a f u n c t i o n v o i d f u n (i n tt t m n ,i n t p p n ),TT p o i n t t o a m r o w,n c o l u m n o ft w o-d i m e n s i o n a l f u n c t i o n s e t,f i n d t h e t w o-d i m e n s

16、i o n a lf u n c t i o n g r o u p,e a c h c o l u m n o f t h e s m a l l e s t e l e m e n t,a n d t h e np l a c e d i n t h e PP s p e c i f i e d o n e-d i m e n s i o n a l a r r a y.Th e n u m b e ri n t h e t w o-d i m e n s i o n a l a r r a y i s g i v e n i n t h e m a i n f u n c t i o n.An s w e r:V o i d f u n (i n t,t t M N,i n t,p p N)In t,I,J,m i n;Fo r (j=0;J N;j+)Mi n=t t 0 j ;Fo r (i=0;I M;i+)If (t t i j m i n)Mi n=t t i j ;Ppj=min;14:fourteenth question,please do not write f

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 营销创新

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