资源描述:
《c语言-课后题答案(c language - answers to questions after class)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、c语言-课后题答案(Clanguage-answerstoquestionsafterclass)Clanguage-after-schoolexercisesanswer:Chapter11.,pleaserefertothischapterexamples,writeaCprogram,outputthefollowinginformation:**************************Verygood!**************************Solution:#includeVoid,main(){Printf("************
2、**************");Printf("");Printf("Verygood,");Printf("");Printf("**************************");}2.writeaCprogram,inputa,B,Cthreevalues,outputthemaximumvalue.Solution:#includeVoid,main(){Int,a,B,C,max;Printf(enterthreenumbersa,B,c:);Scanf("%d,%d,%d",&a,&b,&c);Max=a;If(max3、=b;If(max#
4、includeVoid,main(){Double,P,r=0.1,n=10;P=pow((1+r),n);Printf("%lf",P);}3.asktheprogramtotranslate"China"intoapassword,andthedecodingruleistoreplacetheoriginalletterwiththefourthlettersbehindtheoriginalletter.Forexample,thefourthletterbehindtheletter"A"is"E","E"insteadof"A"".Therefore,
5、"China"shouldbetranslatedas"Glmre"".Pleasewriteaprogram,withthemethodoftheinitialvalueofCl,C2,C3,C4,C5valuesoffivevariableswere'C','H','i','n','a',C1,C2afteroperation,C3,C4,C5,'l'and'G'respectivelyinto'm','r','e',andoutput.Solution:#includeVoid,main(){Charc1='C',c2='h',c3='i',c4='n',c5
6、='a';C1+=4;C2+=4;C3+=4;C4+=4;C5+=4;Printf("passwordis%c%c%c%c%c",C1,C2,C3,C4,C5);}Thirdchapters3.inputdatawiththefollowingscanffunctiontomakea=3,b=7,x=8.5,y=71.82,c1='A',c2='a'.HowdoItypeonthekeyboard?Solution:#includeVoidmain(){Int,a,B,float,x,y,char,C1,c2;Scanf("a=%d,b=%d",&a,&b);S
7、canf("x=%f","y=%e","&x","&y");Scanf("c1=%c","c2=%c","&c1","&c2");}A=3,b=7X=8.5,y=71.82C1=A,c2=a5.circleradiusr=1.5,cylinderh=3,findtheperimeterandareaofacircle,spheresurfacearea,volume,volumeofcylindricalball.Scanfinputdata,output