chap_用c语言编写程序(chap_ programs written in c language)

chap_用c语言编写程序(chap_ programs written in c language)

ID:12080603

大小:64.00 KB

页数:40页

时间:2018-07-15

chap_用c语言编写程序(chap_ programs written in c language)_第1页
chap_用c语言编写程序(chap_ programs written in c language)_第2页
chap_用c语言编写程序(chap_ programs written in c language)_第3页
chap_用c语言编写程序(chap_ programs written in c language)_第4页
chap_用c语言编写程序(chap_ programs written in c language)_第5页
资源描述:

《chap_用c语言编写程序(chap_ programs written in c language)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、chap02_用c语言编写程序(Chap02_programswritteninClanguage)Chap2programswritteninClanguage2.1displaysHelloWorldonthescreen!2.2,Fahrenheittemperatureof100degreesCelsiusFCelsiustemperature2.3calculatepiecewisefunctions2.4outputFahrenheitCelsiustemperatureconversiontableThe2.5generati

2、onpowertableandtableoffactorialsMainpointsofthischapterHowdoyouwriteprogramsanddisplaysomeinformationonthescreen?Howdoyouwriteprogramsthatimplementsimpledataprocessing,suchasconvertingFahrenheittoCelsius?HowdoIuseifstatementstocalculatesegmentationfunctions?HowdoIrequest1+

3、2+withtheforstatement?......+100?Howtodefineandcallthefunctiontogenerateapowertable?2.1displaysHelloWorldonthescreen!Example2-1showsashortsentenceonthescreen:HelloWorld!2.1displaysHelloWorldonthescreen!*display"HelloWorld!"*/commenttext#includeIntmain(void)primary

4、function{Printf("Hello,World,");statementendedReturn0;}Outputfunctionlinebreak2.1displaysomeinformationonthescreenExample2-2isdisplayedonthescreen:Programmingisfun!And,Programming,in,C,is,even,more,fun!#includecompilerpreprocessorIntmain(void){Printf("Programmin

5、g,is,fun,");Printf(And,Programming,in,C,is,even,more,fun,);Return0;}2.2,Fahrenheittemperatureof100degreesCelsiusFCelsiustemperatureThetemperatureisC=(5/9)(F-32)2.2.1programanalysis2.2.2constants,variables,anddatatypes2.2.3arithmeticoperationsandassignmentoperations2.2.

6、4formatoutputfunctionprintf2.2.1programanalysisExample2-3forFahrenheittemperature100degreesFCelsiustemperature.ThetemperatureisC=(5/9)(F-32)#includeIntmain(void){Int,Celsius,Fahr;variabledefinitionsFahr=100;variableusageCelsius=5*(Fahr-32)/9;Printf("Fahr=%d,Celsiu

7、s=%d","Fahr","Celsius");outputresultsReturn0;}2.2.2constants,variables,anddatatypesInt,Celsius,fahr;Celsius=5*(Fahr-32)/9;dataConstant:thevalueofaprogramcannotbechangedduringtheprogram'soperationVariable:thevalueofaprogramcanbechangedduringtherunoftheprogramdatatypeConst

8、ants:5and9areintegerconstants(integers)Variable:specifiedatdefinitionDefinitionofvariable

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

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

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