资源描述:
《c语言函数复习题答案》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、C语言函数复习题答案Clanguagefunctionreviewquestionsanswer1,/*programforAB(BpowerA).Requirements:toachievethefunctionofAB,usingfunctiontoachieve,inthemainfunctiontoachievedataA,Binputandoutputoftheresults・WhereBisapositiveinteger,andAisanyrealnumber・*/#inelude"stdio.Void,main(){longcm(int,x,int,y);Int
2、A;intB;inti=l;longs=l:Printf(〃enterthebaseandpower");Scanf(〃%d%d〃,〃&A〃,〃&B〃);If(i<=B)S=cm(A,B);Printf(〃s=%d〃,s);}Longcm(int,x,int,y){longs=l;For(i二1;i〈二y;i++)s二s*x;Returns;}4,/*writefunction,thetwostring(donotusethestrcatlibraryfunction).ttinclude〃stdio.ttinclude〃stdio.Void,main()(char,a[2
3、0],b[20];Voidcat(char,a[],char,b[]);Gets(a);gets(B);Cat(a,B);Puts(a);Voidcat(char,a[],char,b[])(int,AA,BB,I,j;Aa=strlen(a),bb=strlen(B);For(i=aa,j=0;j