欢迎来到天天文库
浏览记录
ID:50897484
大小:48.50 KB
页数:7页
时间:2020-03-15
《c语言编程全部练习.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、命名文件和邮件名相同压缩包内文件无所谓3414_E01.zip在下周二上课前交Exercise1:ProgrammingEnvironmentandBasicInput/Output1.Writeaprogramthatprints“Thisismyfirstprogram!”onthescreen.(a)Savethisprogramontoyourowndiskwiththenameofe2-1a;(b)RunthisprogramwithoutopeningTurboC;(c)Modifythispr
2、ogramtoprint“Thisismysecondprogram!”,thensaveitase2-1b.Pleasedonotoverwritethefirstprogram.2.Writeaprogramthatprintsthenumber1to4onthesameline.Writetheprogramusingthefollowingmethods:(a)Usingfour“printf”statements.(b)Usingone“printf”statementwithnoconversi
3、onspecifier(i.e.no‘%’).(c)Usingone“printf”statementwithfourconversionspecifiers3.(a)Writeaprogramthatcalculatesanddisplaysthenumberofminutesin15days.(b)Writeaprogramthatcalculatesanddisplayshowmanyhours180minutesequalto.(c)(Optional)Howabout174minutes?Exer
4、cise2:DataTypesandArithmeticOperations1.Youpurchasealaptopcomputerfor$889.Thesalestaxrateis6percent.WriteandexecuteaCprogramthatcalculatesanddisplaysthetotalpurchaseprice(netprice+salestax).2.Writeaprogramthatreadsintheradiusofacircleandprintsthecircle’sdi
5、ameter,circumferenceandarea.Usethevalue3.14159for“p”.3.Writeaprogramthatreadsintwonumbers:anaccountbalanceandanannualinterestrateexpressedasapercentage.Yourprogramshouldthendisplaythenewbalanceafterayear.Therearenodepositsorwithdraws–justtheinterestpayment
6、.Yourprogramshouldbeabletoreproducethefollowingsamplerun:Interestcalculationprogram.Startingbalance?6000Annualinterestratepercentage?4.25Balanceafteroneyear:6255.00Exercise3:Selectionstructure1.WriteaCprogramthatacceptsastudent’snumericalgrade,convertsthen
7、umericalgradetoPassed(gradeisbetween60-100),Failed(gradeisbetween0-59),orError(gradeislessthan0orgreaterthan100).2.Writeaprogramthataskstheusertoenteranintegernumber,thentellstheuserwhetheritisanoddorevennumber.3.Writeaprogramthatreadsinthreeintegersandthe
8、ndeterminesandprintsthelargestinthegroup.Exercise4:‘switch’statementandsimple“while”repetitionstatement1.Writeaprogramthatreadsthreeintegersanabbreviateddate(forexample:261294)andthatwillprintthedateinfull;fo
此文档下载收益归作者所有