c语言编程全部练习.doc

c语言编程全部练习.doc

ID:50897484

大小:48.50 KB

页数:7页

时间:2020-03-15

c语言编程全部练习.doc_第1页
c语言编程全部练习.doc_第2页
c语言编程全部练习.doc_第3页
c语言编程全部练习.doc_第4页
c语言编程全部练习.doc_第5页
资源描述:

《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

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。