欢迎来到天天文库
浏览记录
ID:34564459
大小:3.79 MB
页数:609页
时间:2019-03-08
《Pointers on C.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、orcedversion1.0,byvivisimo,andpostedinhttp://library.nulastmodified:2011.06.051AQuickStart1.1IntroductionItȱisȱalwaysȱdifficultȱtoȱstartȱdescribingȱaȱprogrammingȱlanguageȱbecauseȱlittleȱdetailsȱdoȱnotȱmakeȱmuchȱsenseȱuntilȱoneȱknowsȱenoughȱtoȱunderstan
2、dȱtheȱȈbigȱpicture.ȈȱInȱthisȱchapter,ȱIȱtryȱtoȱgiveȱyouȱaȱglimpseȱofȱtheȱbigȱpictureȱbyȱlookingȱatȱaȱsampleȱprogramȱandȱexplainingȱitsȱworkingsȱlineȱbyȱline.ȱThisȱsampleȱprogramȱalsoȱshowsȱyouȱhowȱfamiliarȱproceduresȱareȱaccomplishedȱinȱC.ȱThisȱinforma
3、tionȱplusȱtheȱotherȱtopicsȱdiscussedȱinȱtheȱchapterȱintroduceȱyouȱtoȱtheȱbasicsȱofȱtheȱCȱlanguageȱsoȱthatȱyouȱcanȱbeginȱwritingȱusefulȱprograms.ȱȱTheȱprogramȱweȱdissectȱreadsȱtextȱfromȱtheȱstandardȱinput,ȱmodifiesȱit,ȱandȱwritesȱitȱtoȱtheȱstandardȱoutp
4、ut.ȱProgramȱl.lȱfirstȱreadsȱaȱlistȱofȱcolumnȱnumbers.ȱTheseȱnumbersȱareȱpairsȱandȱindicateȱrangesȱofȱcolumnsȱinȱtheȱinputȱline.ȱTheȱlistȱisȱterminatedȱwithȱaȱnegativeȱnumber.ȱTheȱremainingȱinputȱlinesȱareȱreadȱandȱprinted,ȱthenȱtheȱselectedȱcolumnsȱfro
5、mȱtheȱinputȱlinesȱareȱextractedȱandȱprimed.ȱNoteȱthatȱtheȱfirstȱcolumnȱinȱaȱlineȱisȱnumberȱzero.ȱForȱexample,ȱifȱtheȱinputȱisȱȱ491220-1abcdefghijklmnopqrstuvwxyzHellothere,howareyou?Iamfine,thanks.Seeyou!Byeȱthenȱtheȱprogramȱwouldȱproduce:ȱȱOriginalinp
6、ut:abcdefghijklmnopqxstuvwxyzRearrangedline:efghijmnopqrstuDownloadathttp://www.pin5i.com/2ȱChapter1AQuickStartOriginalinput:Hellothere,howareyou?Rearrangedline:otherhowareOriginalinput:Iamfine,thanks.Rearrangedline:fine,thanks.Originalinput:Seeyou!Rea
7、rrangedline:you!Originalinput:ByeRearrangedline:ȱTheȱimportantȱpointȱaboutȱthisȱprogramȱisȱthatȱitȱillustratesȱmostȱofȱtheȱbasicȱtechniquesȱyouȱneedȱtoȱknowȱtoȱbeginȱwritingȱCȱprograms.ȱȱȱȱȱȱȱȱȱ/***Thisprogramreadsinputlinesfromstandardinputandprints**
8、eachinputline,followedbyjustsomeportionsoftheline,to**thestandardoutput.****Thefirstinputisalintofcolumnnumbers,whichendswitha**negativenumber.Thecolumnnumbersarepairedandspecify**rangesofcolumnsfromtheinputlinethataretobeprinted.**Fore
此文档下载收益归作者所有