欢迎来到天天文库
浏览记录
ID:22677257
大小:61.09 KB
页数:74页
时间:2018-10-30
《cprimerplus第6版编程练习答案已下载》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、CPrimerPlusSixthEditionProgrammingExerciseSelectedAnswersChapter2ProgrammingExercisesPE2-‐1/*ProgrammingExercise2-1*/#includeintmain(void){printf("GustavMahler");printf("GustavMahler");printf("Gustav");printf("Mahler");return0;}PE2-‐3/*ProgrammingExercise2-3*/#includeint
2、main(void){intageyears;/*ageinyears*/intagedays;/*ageindays*//*largeagesmayrequirethelongtype*/ageyears=101;agedays=365*ageyears;printf("Anageof%dyearsis%ddays.",ageyears,agedays);return0;}PE2-‐4/*ProgrammingExercise2-4*/#includevoidjolly(void);voiddeny(void);intmain(void){jolly();joll
3、y();jolly();deny();return0;}voidjolly(void){printf("Forhe'sajollygoodfellow!");}voiddeny(void){printf("Whichnobodycandeny!");}PE2-‐6/*ProgrammingExercise2-6*/#includeintmain(void){inttoes;toes=10;74CPrimerPlusSixthEditionProgrammingExerciseSelectedAnswersprintf("toes=%d",toes);prin
4、tf("Twicetoes=%d",2*toes);printf("toessquared=%d",toes*toes);return0;}/*orcreatetwomorevariables,setthemto2*toesandtoes*toes*/PE2-‐8/*ProgrammingExercise2-8*/#includevoidone_three(void);voidtwo(void);intmain(void){printf("startingnow:");one_three();printf("done!");return0;}voidon
5、e_three(void){printf("one");two();printf("three");}voidtwo(void){printf("two");}Chapter3ProgrammingExercisesPE3-‐2/*ProgrammingExercise3-2*/#includeintmain(void){intascii;printf("EnteranASCIIcode:");scanf("%d",&ascii);printf("%distheASCIIcodefor%c.",ascii,ascii);return0;}PE3-‐4/*
6、ProgrammingExercise3-4*/#includeintmain(void){floatnum;printf("Enterafloating-pointvalue:");scanf("%f",&num);printf("fixed-pointnotation:%f",num);printf("exponentialnotation:%e",num);printf("pnotation:%a",num);return0;}74CPrimerPlusSixthEditionProgrammingExerciseSelectedAnswersPE3-
7、‐6/*ProgrammingExercise3-6*/#includeintmain(void){floatmass_mol=3.0e-23;/*massofwatermoleculeingrams*/floatmass_qt=950;/*massofquartofwateringrams*/floatquarts;floatmolecules;printf("Enterthenumberofquartsofwa
此文档下载收益归作者所有