欢迎来到天天文库
浏览记录
ID:8546181
大小:22.45 KB
页数:20页
时间:2018-04-01
《中国石油大学第九章计算机作业(china university of petroleum ninth chapter computer homework)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、中国石油大学第九章计算机作业(ChinaUniversityofPetroleumninthchaptercomputerhomework)Combinationof9.1numbersPleasewritefunctionfun,itsfunctionis:thetwotwodigitpositiveintegera,Bmergetoformaninteger,placedinC.Themergingmethodisthatthetenbitsandbitsoftheaarestoredinthetenbitan
2、dthethousandbitoftheCnumbersequentially,andthetenbitsandthebitsoftheBarestoredinthebitsandthehundredsoftheCnumberssequentially.Forexample,whena=45,b=12,callthisfunction,c=5241.Intfun(inta,intb){intc;C=a/10*10+a%10*1000+b/10+b%10*100;Return(C);}Thejudgmentof9.2
3、primesPleasewritefunctionfun,itsfunctionistojudgewhetheranintegernisaprimenumber,ifitisaprimenumber,thenreturn1,orelsereturn0.Intfun(inta){intC,i;For(i=2;i4、unctionistocalculatethefollowingseriessum,thevalueisreturnedbythefunctionvalue.Forexample,whenn=10,x=0.3,thefunctionvalueis1.349859.Doublefun(doublex,doublen){doublec=1,I,s=1;For(i=1;i<=n;i++){C=c*x/i;S=s+c;}Return(s);}9.4KprimeswhicharelargerthanmandclosetoMP5、leasewriteafunctionwhosefunctionistostoreKprimenumbersgreaterthanintegermandclosetomintothearrayreferredtobyxx.Forexample,ifyouenter175,youshouldoutput1923293137Intfun(intm,intn,intzz[1000]){intc=0,I,a;For(a=m+1;c6、=a){Zz[c]=a;C++;}}Return(zz[c]);}9.5deletethespecifiedcharacterPleasewritethefunctionfun,whosefunctionistodeletethespecifiedcharactersfromthestring.Largeandsmalllettersofthesameletteraredealtwithindifferentcharacters.Charfun(charstr[80],charCH){intI,J,k;K=strl7、en(STR);For(i=0;i8、task,it'samazing!Comeon,let'salsowritearecursiveprogram,andofcourse,we'renotgoingtobeabletowritetoocomplex.Function:Findthesumofintegersntominterval,wheren<=m.Input:Terminationpoin
4、unctionistocalculatethefollowingseriessum,thevalueisreturnedbythefunctionvalue.Forexample,whenn=10,x=0.3,thefunctionvalueis1.349859.Doublefun(doublex,doublen){doublec=1,I,s=1;For(i=1;i<=n;i++){C=c*x/i;S=s+c;}Return(s);}9.4KprimeswhicharelargerthanmandclosetoMP
5、leasewriteafunctionwhosefunctionistostoreKprimenumbersgreaterthanintegermandclosetomintothearrayreferredtobyxx.Forexample,ifyouenter175,youshouldoutput1923293137Intfun(intm,intn,intzz[1000]){intc=0,I,a;For(a=m+1;c6、=a){Zz[c]=a;C++;}}Return(zz[c]);}9.5deletethespecifiedcharacterPleasewritethefunctionfun,whosefunctionistodeletethespecifiedcharactersfromthestring.Largeandsmalllettersofthesameletteraredealtwithindifferentcharacters.Charfun(charstr[80],charCH){intI,J,k;K=strl7、en(STR);For(i=0;i8、task,it'samazing!Comeon,let'salsowritearecursiveprogram,andofcourse,we'renotgoingtobeabletowritetoocomplex.Function:Findthesumofintegersntominterval,wheren<=m.Input:Terminationpoin
6、=a){Zz[c]=a;C++;}}Return(zz[c]);}9.5deletethespecifiedcharacterPleasewritethefunctionfun,whosefunctionistodeletethespecifiedcharactersfromthestring.Largeandsmalllettersofthesameletteraredealtwithindifferentcharacters.Charfun(charstr[80],charCH){intI,J,k;K=strl
7、en(STR);For(i=0;i8、task,it'samazing!Comeon,let'salsowritearecursiveprogram,andofcourse,we'renotgoingtobeabletowritetoocomplex.Function:Findthesumofintegersntominterval,wheren<=m.Input:Terminationpoin
8、task,it'samazing!Comeon,let'salsowritearecursiveprogram,andofcourse,we'renotgoingtobeabletowritetoocomplex.Function:Findthesumofintegersntominterval,wheren<=m.Input:Terminationpoin
此文档下载收益归作者所有