欢迎来到天天文库
浏览记录
ID:36729857
大小:84.75 KB
页数:77页
时间:2019-05-14
《C Primer Plus第6版编程练习问题详解(已下载)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实用标准文案Chapter2ProgrammingExercisesPE2-‐1/*ProgrammingExercise2-1*/#includeintmain(void){printf("GustavMahler");printf("GustavMahler");printf("Gustav");printf("Mahler");return0;}PE2-‐3/*ProgrammingExercise2-3*/#includeintmain(void){intageyears;/*ageiny
2、ears*/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();jolly();jolly()
3、;deny();return0;}voidjolly(void){printf("Forhe'sajollygoodfellow!");}voiddeny(void){printf("Whichnobodycandeny!");}PE2-‐6/*ProgrammingExercise2-6*/#includeintmain(void)精彩文档实用标准文案{inttoes;toes=10;printf("toes=%d",toes);printf("Twicetoes=%d",2*toes);printf("toes
4、squared=%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;}voidone_three(void){printf
5、("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;精彩文档实用标准文案}PE3-‐6/*ProgrammingExercise3-6*/#
7、includeintmain(void){floatmass_mol=3.0e-23;/*massofwatermoleculeingrams*/floatmass_qt=950;/*massofquartofwateringrams*/floatquarts;floatmolecules;printf("Enterthenumberofquartsofwater:");scanf("%f",&quarts);molecules=quarts*mass_qt/mass_mol;printf("%fquartsofwatercont
8、ain%emolecules.",quarts,molecules);return0;}Chapter4Program
此文档下载收益归作者所有