外文翻译computerprogram英文

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ComputerProgram1IntroductionComputerProgram,setofinstructionsthatdirectsacomputertoperformsomeprocessingfunctionorcombinationoffunctions.Fortheinstructionstobecarriedout,acomputermustexecuteaprogram,thatis,thecomputerreadstheprogram,andthenfollowthestepsencodedintheprograminapreciseorderuntilcompletion.Aprogramcanbeexecutedmanydifferenttimes,witheachexecutionyieldingapotentiallydifferentresultdependingupontheoptionsanddatathattheusergivesthecomputer.Programsfallintotwomajorclasses:applicationprogramsandoperatingsystems.Anapplicationprogramisonethatcarriesoutsomefunctiondirectlyforauser,suchaswordprocessingorgame-playing.Anoperatingsystemisaprogramthatmanagesthecomputerandthevariousresourcesanddevicesconnectedtoit,suchasRAM,harddrives,monitors,keyboards,printers,andmodems,sothattheymaybeusedbyotherprograms.ExamplesofoperatingsystemsareDOS,Windows95,OS\2,andUNIX.2ProgramDevelopmentSoftwaredesignerscreatenewprogramsbyusingspecialapplicationsprograms,oftencalledutilityprogramsordevelopmentprograms.Aprogrammerusesanothertypeofprogramcalledatexteditortowritethenewprograminaspecialnotationcalledaprogramminglanguage.Withthetexteditor,theprogrammercreatesatextfile,whichisanorderedlistofinstructions,alsocalledtheprogramsourcefile.Theindividualinstructionsthatmakeuptheprogramsourcefilearecalledsourcecode.Atthispoint,aspecialapplicationsprogramtranslatesthesourcecodeintomachinelanguage,orobjectcode—aformatthattheoperatingsystemwillrecognizeasaproperprogramandbeabletoexecute.Threetypesofapplicationsprogramstranslatefromsourcecodetoobjectcode:compilers,interpreters,andassemblers.Thethreeoperatedifferentlyandondifferenttypesofprogramminglanguages,buttheyservethesamepurposeoftranslatingfromaprogramminglanguageintomachinelanguage.Acompilertranslatestextfileswritteninahigh-levelprogramminglanguage--suchasFORTRAN,C,orPascal—fromthesourcecodetotheobjectcodeallatonce.ThisdiffersfromtheapproachtakenbyinterpretedlanguagessuchasBASIC,APLandLISP,inwhichaprogramistranslatedintoobjectcodestatementbystatementaseachinstructionisexecuted.Theadvantagetointerpretedlanguagesisthattheycanbeginexecutingtheprogramimmediatelyinsteadofhavingtowaitforallofthesourcecodetobecompiled.Changescanalsobemadetotheprogramfairlyquicklywithouthavingtowaitforittobecompiledagain.Thedisadvantageofinterpretedlanguagesisthattheyareslowtoexecute,sincetheentireprogrammustbetranslatedoneinstructionatatime,eachtimetheprogramisrun.Ontheotherhand,compiledlanguagesarecompiledonlyonceandthuscanbeexecutedbythecomputermuchmorequicklythaninterpretedlanguages.Forthisreason,compiledlanguagesaremorecommonandarealmostalwaysusedinprofessionalandscientificapplications.Anothertypeoftranslatoristheassembler,whichisusedforprogramsorpartsofprogramswritteninassemblylanguage.Assemblylanguageisanotherprogramminglanguage,butitismuchmoresimilartomachinelanguagethanothertypesofhigh-levellanguages.Inassemblylanguage,asinglestatementcanusuallybetranslatedintoasingleinstructionofmachinelanguage.Today,assemblylanguageisrarelyusedtowriteanentireprogram,butisinsteadmostoftenusedwhentheprogrammerneedstodirectlycontrolsomeaspectofthecomputer’sfunction.Programsareoftenwrittenasasetofsmallerpieces,witheachpiecerepresentingsomeaspectoftheoverallapplicationprogram.Aftereachpiecehasbeencompiledseparately,aprogramcalledalinkercombinesallofthetranslatedpiecesintoasingleexecutableprogram.Programsseldomworkcorrectlythefirsttime,soaprogramcalledadebuggerisoftenusedtohelpfindproblemscalledbugs.Debuggingprogramsusuallydetectaneventintheexecutingprogramandpointtheprogrammerbacktotheoriginoftheeventintheprogramcode.Recentprogrammingsystems,suchasJava,useacombinationofapproachestocreateandexecuteprograms.AcompilertakesaJavasourceprogramandtranslatesitintoanintermediateform.SuchintermediateprogramsarethentransferredovertheInternetintocomputerswhereaninterpreterprogramthenexecutestheintermediateformasanapplicationprogram.3ProgramElementsMostprogramsarebuiltfromjustafewkindsofstepsthatarerepeatedmanytimesindifferentcontextsandindifferentcombinationsthroughouttheprogram.Themostcommonstepperformssomecomputation,andthenproceedstothenextstepintheprogram,intheorderspecifiedbytheprogrammer.Programsoftenneedtorepeatashortseriesofstepsmanytimes,forinstanceinlookingthroughalistofgamescoresandfindingthehighestscore.Suchrepetitivesequencesofcodearecalledloops.Oneofthecapabilitiesthatmakescomputersousefulistheirabilitytomakeconditionaldecisionsandperformdifferentinstructionsbasedonthevaluesofdatabeingprocessed.If-then-elsestatementsimplementthisfunctionbytestingsomepieceofdataandthenselectingoneoftwosequencesofinstructionsonthebasisoftheresult.Oneoftheinstructionsinthesealternativesmaybeagotostatementthatdirectsthecomputertoselectitsnextinstructionfromadifferentpartoftheprogram.Forexample,aprogrammightcomparetwonumbersandbranchtoadifferentpartoftheprogramdependingontheresultofthecomparison:IfxisgreaterthanyThenGotoinstruction#10ElsecontinueProgramoftenuseaspecificsequenceofstepsmorethanonce.Suchasequenceofstepscanbegroupedto

1 / 12
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功