




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
ComputerEnglish
(FourthEdition)Unit3ComputerLanguageandProgramming
SectionAProgrammingLanguage廈門(mén)理工學(xué)院陳丹波ProgrammingLanguage-IntroductionI.IntroductionProgramminglanguages,incomputerscience,aretheartificiallanguagesusedtowriteasequenceofinstructions(acomputerprogram)thatcanberunbyacomputer.Similartonaturallanguages,suchasEnglish,programminglanguageshaveavocabulary,grammar,andsyntax.Asequence一系列Vocabulary詞匯Syntax句法I.引言在計(jì)算機(jī)科學(xué)中,編程語(yǔ)言是用于編寫(xiě)可由計(jì)算機(jī)運(yùn)行的一系列指令(計(jì)算機(jī)程序)的人工語(yǔ)言。與英語(yǔ)等自然語(yǔ)言相類似,編程語(yǔ)言有詞匯、語(yǔ)法和句法。
ProgrammingLanguage-IntroductionHowever,naturallanguagesarenotsuitedforprogrammingcomputersbecausetheyareambiguous,meaningthattheirvocabularyandgrammaticalstructuremaybeinterpretedinmultipleways.然而,自然語(yǔ)言不適合為計(jì)算機(jī)編程,因?yàn)樗鼈儠?huì)引起歧義,也就是說(shuō)它們的詞匯和語(yǔ)法的結(jié)構(gòu)可能被用多種方式進(jìn)行解釋Suitfor適合于Ambiguous模糊的,含糊的Grammatical語(yǔ)法的Thelanguagesusedtoprogram
computersmusthavesimplelogicalstructures,andtherulesfortheirgrammar,spelling,andpunctuation
mustbeprecise.ProgrammingLanguage-IntroductionProgram編程Spelling拼寫(xiě)Punctuation標(biāo)點(diǎn)符號(hào)用于計(jì)算機(jī)編程的語(yǔ)言必須有簡(jiǎn)單的邏輯結(jié)構(gòu),它們的語(yǔ)法、拼寫(xiě)和標(biāo)點(diǎn)符號(hào)的規(guī)則必須精確。ProgrammingLanguage-IntroductionProgramminglanguagesvarygreatlyintheirsophistication
andintheirdegreeofversatility.Someprogramminglanguagesarewrittentoaddress
aparticularkindofcomputingproblemorforuseonaparticularmodelofcomputersystem.
Vary:變化的,差異的Sophistication復(fù)雜性,復(fù)雜Versatility通用性,多用性address處理,操作編程語(yǔ)言在復(fù)雜性和通用程度上差異很大。一些編程語(yǔ)言是為了處理特定類型的計(jì)算問(wèn)題或?yàn)榱擞糜谔囟ㄐ吞?hào)的計(jì)算機(jī)系統(tǒng)而編寫(xiě)的。ProgrammingLanguage-IntroductionForinstance,programminglanguagessuchasFORTRANandCOBOLwerewrittentosolvecertaingeneraltypesofprogrammingproblems—FORTRANforscientificapplications,andCOBOLforbusinessapplications.
例如,F(xiàn)ORTRAN和COBOL等編程語(yǔ)言是為解決某些普遍的編程問(wèn)題類型而編寫(xiě)的——FORTRAN是為了科學(xué)領(lǐng)域的應(yīng)用,而COBOL是為了商業(yè)領(lǐng)域的應(yīng)用。ProgrammingLanguage-Introduction
Althoughtheselanguagesweredesignedtoaddressspecificcategoriesofcomputerproblems,theyarehighlyportable,meaningthattheymaybeusedtoprogrammanytypesofcomputers.Portable:輕便的,可攜帶的盡管這些語(yǔ)言旨在處理特定類型的計(jì)算機(jī)問(wèn)題,但它們具有很高的可移植性,也就是說(shuō)它們可以用來(lái)為多種類型的計(jì)算機(jī)編程O(píng)therlanguages,suchasmachinelanguages,aredesignedtobeusedbyonespecificmodelofcomputersystem,orevenbyonespecificcomputerincertainresearchapplications.Themostcommonlyusedprogramminglanguagesarehighlyportableandcanbeusedtoeffectivelysolvediversetypesofcomputingproblems.LanguageslikeC,PASCAL,andBASICfallintothiscategory。ProgrammingLanguage-IntroductionDiverse不同的,區(qū)別的Fallintothiscategory屬于這一類型其他的語(yǔ)言,如機(jī)器語(yǔ)言,是為一種特定型號(hào)的計(jì)算機(jī)系統(tǒng),甚至是一臺(tái)特定的計(jì)算機(jī),在某些研究領(lǐng)域的使用而編寫(xiě)的.最常用的編程語(yǔ)言具有很高的可移植性,可以用于有效地解決不同類型的計(jì)算問(wèn)題。像C、PASCAL和BASIC這樣的語(yǔ)言就屬于這一范疇ProgrammingLanguage-LanguageTypes
Ⅱ.LanguageTypes
Programminglanguagescanbeclassifiedaseitherlow-levellanguagesorhigh-levellanguages.Low-levelprogramminglanguages,ormachinelanguages,arethemostbasictypeofprogramminglanguagesandcanbeunderstooddirectlybyacomputer.Machinelanguages
differdependingonthemanufacturerandmodelofcomputer.Classify:分類,分等級(jí)Differ不同的語(yǔ)言類型
編程語(yǔ)言可分為低級(jí)語(yǔ)言和高級(jí)語(yǔ)言。低級(jí)編程語(yǔ)言或機(jī)器語(yǔ)言,是編程語(yǔ)言中最基礎(chǔ)的類型,可以被計(jì)算機(jī)直接理解。機(jī)器語(yǔ)言視計(jì)算機(jī)制造商與型號(hào)不同而有所區(qū)別High-levellanguagesareprogramminglanguagesthatmustfirstbetranslatedintoamachinelanguagebeforetheycanbeunderstoodandprocessedbyacomputer.高級(jí)語(yǔ)言是必須首先翻譯成機(jī)器語(yǔ)言計(jì)算機(jī)才能理解和處理的編程語(yǔ)言ProgrammingLanguage-LanguageTypesProgrammingLanguage-LanguageTypesExamplesofhigh-levellanguagesareC,C++,PASCAL,andFORTRAN.
Assemblylanguages
areintermediatelanguages
thatareveryclosetomachinelanguagesanddonothavetheleveloflinguisticsophisticationexhibitedbyotherhigh-levellanguages,butmuststillbetranslatedintomachinelanguage.Assembly匯編Linguistic:語(yǔ)言學(xué)的,語(yǔ)言的intermediate:中間的,中級(jí)的C、C++、PASCAL和FORTRAN都是高級(jí)語(yǔ)言的例子。匯編語(yǔ)言是中級(jí)語(yǔ)言,非常接近于機(jī)器語(yǔ)言,沒(méi)有其他高級(jí)語(yǔ)言所表現(xiàn)出的語(yǔ)言復(fù)雜程度,但仍然得翻譯成機(jī)器語(yǔ)言。ProgrammingLanguage-LanguageTypes1.MachineLanguagesInmachinelanguages,instructionsarewrittenassequencesof1sand0s,calledbits,thatacomputercanunderstanddirectly.Aninstructioninmachinelanguagegenerallytellsthecomputerfourthings:1.機(jī)器語(yǔ)言在機(jī)器語(yǔ)言中,指令被寫(xiě)成計(jì)算機(jī)能夠直接理解的1和0(稱作位)序列。一條機(jī)器語(yǔ)言的指令一般告訴計(jì)算機(jī)4件事:ProgrammingLanguage-LanguageTypes
(1)到計(jì)算機(jī)主存(隨機(jī)存儲(chǔ)器)的什么位置去找一兩個(gè)數(shù)字或簡(jiǎn)單的數(shù)據(jù)片;(2)要執(zhí)行的簡(jiǎn)單操作,如將兩個(gè)數(shù)字相加;(3)在主存的什么位置存放該簡(jiǎn)單操作的結(jié)果;(4)到什么位置去找下一條要執(zhí)行的指令(1)wheretofindoneortwonumbersorsimplepiecesofdatainthemaincomputermemory(RandomAccessMemory,orRAM),(2)asimpleoperationtoperform,suchasaddingthetwonumberstogether,(3)whereinthemainmemorytoputtheresultofthissimpleoperation,and(4)wheretofindthenextinstructiontoperform.ProgrammingLanguage-LanguageTypes
Whileallexecutableprogramsareeventuallyreadbythecomputerinmachinelanguage,theyarenotallprogrammedinmachinelanguage.Itisextremelydifficulttoprogramdirectlyinmachinelanguagebecausetheinstructionsaresequencesof1sand0s.Atypicalinstructioninamachinelanguagemightread1001011001011andmeanaddthecontentsofstorageregister
AtothecontentsofstorageregisterB.Executable可執(zhí)行的Register寄存器盡管所有的可執(zhí)行程序最終都是以機(jī)器語(yǔ)言的形式被計(jì)算機(jī)讀入的,但它們并非都是用機(jī)器語(yǔ)言編寫(xiě)的。直接用機(jī)器語(yǔ)言編程極端困難,因?yàn)橹噶钍?和1的序列。一條典型的機(jī)器語(yǔ)言指令可能寫(xiě)成1001011001011,意思是把存儲(chǔ)寄存器A的內(nèi)容加到存儲(chǔ)寄存器B的內(nèi)容中。ProgrammingLanguage-LanguageTypes
Statement語(yǔ)句2.高級(jí)語(yǔ)言
高級(jí)語(yǔ)言是相對(duì)復(fù)雜的一系列語(yǔ)句,它們使用來(lái)自人類語(yǔ)言的詞匯和句法。高級(jí)語(yǔ)言比匯編語(yǔ)言或機(jī)器語(yǔ)言類似于正常的人類語(yǔ)言,因此用之來(lái)編寫(xiě)復(fù)雜的程序比較容易。2.High-LevelLanguagesHigh-levellanguagesarerelativelysophisticatedsetsofstatements
utilizingwordsandsyntaxfromhumanlanguage.Theyaremoresimilartonormalhumanlanguagesthanassemblyormachinelanguagesandarethereforeeasiertouseforwritingcomplicatedprograms.ProgrammingLanguage-LanguageTypesTheseprogramminglanguagesallowlargerandmorecomplicatedprogramstobedevelopedfaster.However,high-levellanguagesmustbetranslatedintomachinelanguagebyanotherprogramcalledacompiler
beforeacomputercanunderstandthem.Forthisreason,programswritteninahigh-levellanguagemaytakelongertoexecuteanduseupmorememorythanprogramswritteninanassemblylanguage.Compiler編譯器Forthisreason因此Useup占用這些編程語(yǔ)言可以更快地開(kāi)發(fā)更大和更復(fù)雜的程序。然而,高級(jí)語(yǔ)言必須由稱為編譯器的另外一種程序翻譯成機(jī)器語(yǔ)言,計(jì)算機(jī)才能理解它們。因?yàn)檫@個(gè)原因,與用匯編語(yǔ)言編寫(xiě)的程序相比較,用高級(jí)語(yǔ)言編寫(xiě)的程序可能運(yùn)行時(shí)間長(zhǎng),占用內(nèi)存多。ProgrammingLanguage-LanguageTypes3.AssemblyLanguagesComputerprogrammersuseassemblylanguagestomakemachine-languageprogramseasiertowrite.Inanassemblylanguage,eachstatementcorrespondsroughlytoonemachinelanguageinstruction.Anassemblylanguagestatementiscomposedwiththeaidofeasytoremembercommands.Roughly粗糙的,大致的Withtheaidof借助于3.匯編語(yǔ)言計(jì)算機(jī)程序員通過(guò)使用匯編語(yǔ)言,使機(jī)器語(yǔ)言程序比較容易編寫(xiě)。在匯編語(yǔ)言中,每個(gè)語(yǔ)句大致對(duì)應(yīng)于一條機(jī)器語(yǔ)言指令。一條匯編語(yǔ)言的語(yǔ)句是借助于易于記憶的命令編寫(xiě)的。ProgrammingLanguage-LanguageTypesThecommandtoaddthecontentsofthestorageregisterAtothecontentsofstorageregisterBmightbewrittenADDB,Ainatypicalassemblylanguagestatement.Typical典型的在一個(gè)典型的匯編語(yǔ)言語(yǔ)句中,把存儲(chǔ)寄存器A的內(nèi)容加到存儲(chǔ)寄存器B的內(nèi)容中這一命令,可能寫(xiě)成ADDB,A。ProgrammingLanguage-LanguageTypesAssemblylanguagessharecertainfeatureswithmachinelanguages.Forinstance,itispossibletomanipulatespecificbitsinbothassemblyandmachinelanguages.Programmersuseassemblylanguageswhenitisimportanttominimizethetimeittakestorunaprogram,becausethetranslationfromassemblylanguagetomachinelanguageisrelativelysimple.Minimize最小化,盡量減少匯編語(yǔ)言與機(jī)器語(yǔ)言具有某些共同的特征。例如,對(duì)特定的位進(jìn)行操控,用匯編語(yǔ)言和機(jī)器語(yǔ)言都是可行的。當(dāng)盡量減少程序的運(yùn)行時(shí)間很重要時(shí),程序員就使用匯編語(yǔ)言,因?yàn)閺膮R編語(yǔ)言到機(jī)器語(yǔ)言的翻譯相對(duì)簡(jiǎn)單。ProgrammingLanguage-LanguageTypesAssemblylanguagesarealsousedwhensomepartofthecomputerhastobecontrolleddirectly,suchasindividualdotsonamonitorortheflowofindividualcharacterstoaprinter.Dot點(diǎn)Character字符匯編語(yǔ)言也用于計(jì)算機(jī)的某個(gè)部分必須被直接控制的情況,如監(jiān)視器上的單個(gè)點(diǎn)或者單個(gè)字符向打印機(jī)的流動(dòng)。ProgrammingLanguage-ClassificationofHigh-LevelLanguages
III.ClassificationofHigh-LevelLanguages
High-levellanguagesarecommonlyclassifiedasprocedure-oriented,functional,object-oriented,orlogiclanguages.Themostcommonhigh-levellanguagestodayareprocedure-orientedlanguages.Classification分類,歸類Procedure過(guò)程,程序Orient定向的,面向的III.高級(jí)語(yǔ)言的分類語(yǔ)言高級(jí)通常分為面向過(guò)程語(yǔ)言、函數(shù)式語(yǔ)言、面向?qū)ο笳Z(yǔ)言或邏輯語(yǔ)言。當(dāng)今最常見(jiàn)的高級(jí)語(yǔ)言是面向過(guò)程語(yǔ)言。
ProgrammingLanguage-ClassificationofHigh-LevelLanguagesIntheselanguages,oneormorerelatedblocksofstatementsthatperformsomecompletefunctionaregroupedtogetherintoaprogrammodule,orprocedure,andgivenanamesuchas“procedureA.”
Ifthesamesequenceofoperationsisneededelsewhereintheprogram,asimplestatementcanbeusedtoreferbacktotheprocedure.
Programmodule程序模塊Referbackto調(diào)回,找回在這種語(yǔ)言中,執(zhí)行某個(gè)完整功能的一個(gè)或多個(gè)相關(guān)的語(yǔ)句塊組成一個(gè)程序模塊或過(guò)程,而且被給予諸如“過(guò)程A”一類名稱。如果在程序的其他地方需要同樣的操作序列,可以使用一個(gè)簡(jiǎn)單的語(yǔ)句調(diào)回這個(gè)過(guò)程。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesInessence,aprocedureisjustamini-program.Alargeprogramcanbeconstructedbygroupingtogetherproceduresthatperformdifferenttasks.Procedurallanguages
allowprogramstobeshorterandeasierforthecomputertoread,buttheyrequiretheprogrammertodesigneachproceduretobegeneralenoughtobeusedindifferentsituations.Essence本質(zhì),實(shí)質(zhì)Procedurallanguage過(guò)程語(yǔ)言General一般的,通用的實(shí)質(zhì)上,一個(gè)過(guò)程就是一個(gè)小型程序。一個(gè)大型程序可以通過(guò)將執(zhí)行不同任務(wù)的過(guò)程組合在一起而構(gòu)成。過(guò)程語(yǔ)言使程序變得比較短,而且比較容易被計(jì)算機(jī)讀取,但要求程序員將每個(gè)過(guò)程都設(shè)計(jì)得足夠通用,能用于不同的情況。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesFunctionallanguages
treatprocedureslikemathematicalfunctionsandallowthemtobeprocessedlikeanyotherdatainaprogram.Thisallowsamuchhigherandmorerigorous
levelofprogramconstruction.Functionallanguage函數(shù)式語(yǔ)言Rigorous嚴(yán)格的,嚴(yán)密的函數(shù)式語(yǔ)言像對(duì)待數(shù)學(xué)函數(shù)一樣對(duì)待過(guò)程,并允許像處理程序中的任何其他數(shù)據(jù)一樣處理它們。這就使程序構(gòu)造在更高、更嚴(yán)密的水平上得以實(shí)現(xiàn)。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesFunctionallanguagesalsoallowvariables—symbolsfordatathatcanbespecifiedandchangedbytheuserastheprogramisrunning—tobegivenvaluesonlyonce.Thissimplifiesprogrammingbyreducingtheneedtobeconcernedwiththeexactorderofstatementexecution,sinceavariabledoesnothavetoberedeclared,orrestated,eachtimeitisusedinaprogramstatement.Variable變量Simplify使簡(jiǎn)化Restate重新說(shuō)明函數(shù)式語(yǔ)言也允許變量——在程序運(yùn)行過(guò)程中可以被用戶指定和更改的數(shù)據(jù)符號(hào)——只被賦值一次。這樣,通過(guò)減少對(duì)語(yǔ)句執(zhí)行的確切順序給予關(guān)注的必要性,就簡(jiǎn)化了編程,因?yàn)橐粋€(gè)變量沒(méi)有必要每次在一個(gè)程序語(yǔ)句中用到,都重新聲明或重新說(shuō)明。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesManyoftheideasfromfunctionallanguageshavebecomekeypartsofmanymodernprocedurallanguages.Object-orientedlanguagesareoutgrowthsoffunctionallanguages.Inobject-orientedlanguages,thecodeusedtowritetheprogramandthedataprocessedbytheprogramaregroupedtogetherintounitscalledobjects.Outgrowth發(fā)展結(jié)果來(lái)自函數(shù)式語(yǔ)言的許多思想已經(jīng)成為許多現(xiàn)代過(guò)程語(yǔ)言的關(guān)鍵部分。面向?qū)ο笳Z(yǔ)言是函數(shù)式語(yǔ)言的發(fā)展結(jié)果。在面向?qū)ο笳Z(yǔ)言中,用來(lái)編寫(xiě)程序的代碼和由程序處理的數(shù)據(jù),組合成叫做對(duì)象的單元ProgrammingLanguage-ClassificationofHigh-LevelLanguagesObjectsarefurthergroupedintoclasses,whichdefinetheattributesobjectsmusthave.AsimpleexampleofaclassistheclassBook.ObjectswithinthisclassmightbeNovelandShortStory.Class類Attribute屬性,特性對(duì)象進(jìn)一步組合成類,而類則定義對(duì)象必須具有的屬性。類的一個(gè)簡(jiǎn)單例子就是書(shū)這個(gè)類。這個(gè)類中的對(duì)象可能是小說(shuō)和短篇小說(shuō)ProgrammingLanguage-ClassificationofHigh-LevelLanguagesObjectsalsohavecertainfunctionsassociatedwiththem,calledmethods.Thecomputeraccessesanobjectthroughtheuseofoneoftheobject’smethods.Themethodperformssomeactiontothedataintheobjectandreturnsthisvaluetothecomputer.對(duì)象還有某些與其相關(guān)的功能,稱為方法。計(jì)算機(jī)通過(guò)使用一個(gè)對(duì)象的某種方法來(lái)訪問(wèn)該對(duì)象。方法對(duì)對(duì)象中的數(shù)據(jù)執(zhí)行某種操作,然后將值返回給計(jì)算機(jī)。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesClassesofobjectscanalsobefurthergroupedintohierarchies,inwhichobjectsofoneclasscaninheritmethodsfromanotherclass.Thestructureprovidedinobject-orientedlanguagesmakesthemveryusefulforcomplicatedprogrammingtasks.
Hierarchy階層inherit:繼承,遺傳對(duì)象的類也可進(jìn)一步組合成層,而在層中一個(gè)類的對(duì)象可繼承另一個(gè)類的方法。面向?qū)ο笳Z(yǔ)言提供的這種結(jié)構(gòu),使該語(yǔ)言對(duì)于復(fù)雜的編程任務(wù)非常有用。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesLogiclanguagesuselogicastheirmathematicalbase.Alogicprogramconsistsofsetsoffactsandif-thenrules,whichspecifyhowonesetoffactsmaybededuced
fromothers,forexample:IfthestatementXistrue,thenthestatementYisfalse.Deduce推斷,推導(dǎo)邏輯語(yǔ)言將邏輯用作其數(shù)學(xué)基礎(chǔ)。邏輯程序由事實(shí)組和“如果―則”規(guī)則構(gòu)成,“如果―則”規(guī)則具體說(shuō)明一組事實(shí)如何可以從其他事實(shí)組中推斷出來(lái),例如:如果X語(yǔ)句為真,則Y語(yǔ)句為假。ProgrammingLanguage-ClassificationofHigh-LevelLanguagesIntheexecutionofsuchaprogram,aninputstatementcanbelogicallydeducedfromotherstatementsintheprogram.Manyartificialintelligenceprogramsarewritteninsuchlanguages.在這樣一個(gè)程序的執(zhí)行過(guò)程中,一條輸入語(yǔ)句可以按照邏輯從程序中的其他語(yǔ)句推斷出來(lái)。許多人工智能程序使用這種語(yǔ)言編寫(xiě)。ProgrammingLanguage-LanguageStructureandComponents
IV.
LanguageStructureandComponents
Programminglanguagesusespecifictypesofstatements,orinstructions,toprovidefunctionalstructuretotheprogram.Astatementinaprogramisabasicsentencethatexpressesasimpleidea—itspurposeistogivethecomputerabasicinstruction.IV.語(yǔ)言結(jié)構(gòu)與成分編程語(yǔ)言使用特定類型的語(yǔ)句或指令,來(lái)給程序提供功能結(jié)構(gòu)。程序中的一個(gè)語(yǔ)句是表達(dá)一個(gè)簡(jiǎn)單想法的基本句子——它的目的是給計(jì)算機(jī)一條基本指令。
ProgrammingLanguage-LanguageStructureandComponentsStatementsdefinethetypesofdataallowed,howdataaretobemanipulated,andthewaysthatproceduresandfunctionswork.Programmersusestatementstomanipulatecommoncomponentsofprogramminglanguages,suchasvariablesandmacros
(mini-programswithinaprogram).Macros宏mini-programs小程序語(yǔ)句定義所允許的數(shù)據(jù)類型、數(shù)據(jù)如何處理以及過(guò)程和函數(shù)的工作方式。程序員使用語(yǔ)句來(lái)操控編程語(yǔ)言的常見(jiàn)成分,如變量和宏(程序中的小程序段)。ProgrammingLanguage-LanguageStructureandComponentsStatementsknownasdatadeclarations
givenamesandpropertiestoelementsofaprogramcalledvariables.Variablescanbeassigneddifferentvalueswithintheprogram.
Declaration:
聲明property:財(cái)產(chǎn),特性Assign賦予數(shù)據(jù)聲明語(yǔ)句給稱為變量的那些程序元素以名稱和屬性。變量在程序中可以賦予不同的值.Thepropertiesvariablescanhavearecalledtypes,andtheyincludesuchthingsaswhatpossiblevaluesmightbesavedinthevariables,howmuchnumericalaccuracyistobeusedinthevalues,andhowonevariablemayrepresentacollectionofsimplervaluesinanorganizedfashion,suchasatableorarray.ProgrammingLanguage-LanguageStructureandComponentsacollectionof一組fashion方式Table表格array數(shù)組變量可以具有的屬性稱為類型,它們包括:變量中能保存哪些可能的值;這些值中使用何種程度的數(shù)值精度;以及一個(gè)變量可以如何以有組織結(jié)構(gòu)的方式——如以表或數(shù)組的形式——表示一組比較簡(jiǎn)單的值ProgrammingLanguage-LanguageStructureandComponentsInmanyprogramminglanguages,akeydatatypeisapointer.Variablesthatarepointersdonotthemselveshavevalues;instead,theyhaveinformationthatthecomputercanusetolocatesomeothervariable—thatis,theypointtoanothervariable.Pointer指針在許多編程語(yǔ)言中,一個(gè)關(guān)鍵的數(shù)據(jù)類型是指針。指針變量本身沒(méi)有值,而是含有計(jì)算機(jī)可以用來(lái)查找某個(gè)其他變量的信息——也就是說(shuō),它們指向另一個(gè)變量。ProgrammingLanguage-LanguageStructureandComponentsAnexpression
isapieceofastatementthatdescribesaseriesofcomputationstobeperformedonsomeoftheprogram’svariables,suchasX+Y/Z,inwhichthevariablesareX,Y,andZandthecomputationsareadditionanddivision.Expression表達(dá)式Division除法一個(gè)表達(dá)式是語(yǔ)句的一段,用于描述要對(duì)一些程序變量執(zhí)行的一系列計(jì)算操作,如X+Y/Z,其中X、Y和Z為變量,加法和除法是計(jì)算操作。ProgrammingLanguage-LanguageStructureandComponentsAnassignmentstatement
assignsavariableavaluederivedfromsomeexpression,whileconditional
statements
specifyexpressionstobetestedandthenusedtoselectwhichotherstatementsshouldbeexecutednext.Assignment賦值derivedfrom來(lái)自,衍生于一個(gè)賦值語(yǔ)句給一個(gè)變量賦予來(lái)自某個(gè)表達(dá)式的值,而條件語(yǔ)句則指定要被測(cè)試、然后用于選擇接下來(lái)應(yīng)該執(zhí)行那些其他語(yǔ)句的表達(dá)式。ProgrammingLanguage-LanguageStructureandComponentsProcedureandfunctionstatements
definecertainblocksofcodeasproceduresorfunctionsthatcanthenbereturnedtolaterintheprogram.Thesestatementsalsodefinethekindsofvariablesandparameters
theprogrammercanchooseandthetypeofvaluethatthecodewillreturnwhenanexpressionaccessestheprocedureorfunction.Function函數(shù)Parameter參數(shù)過(guò)程和函數(shù)語(yǔ)句將某些代碼塊定義為以后可在程序中回調(diào)的過(guò)程或函數(shù)。這些語(yǔ)句也定義程序員可選的變量和參數(shù)種類,以及當(dāng)表達(dá)式訪問(wèn)過(guò)程或函數(shù)時(shí)代碼所返回的值的類型。ProgrammingLanguage-LanguageStructureandComponentsManyprogramminglanguagesalsopermitminitranslationprogramscalledmacros.Macrostranslatesegmentsofcodethathavebeenwritteninalanguagestructuredefinedbytheprogrammerintostatementsthattheprogramminglanguageunderstands.Minitranslation小翻譯Segments段,塊許多編程語(yǔ)言也容許叫做宏的小翻譯程序。宏將那些用程序員定義的語(yǔ)言結(jié)構(gòu)編寫(xiě)的代碼段翻譯成編程語(yǔ)言可以理解的語(yǔ)句。ProgrammingLanguage-History
V.
History
Programmingl
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 石大學(xué)前兒童保育學(xué)課件6-4生活制度
- 2025年家政服務(wù)職業(yè)技能競(jìng)賽試題
- 智能家居系統(tǒng)在社區(qū)安全中的應(yīng)用-洞察闡釋
- 高中美術(shù)鑒賞《沒(méi)有什么不可能》教學(xué)設(shè)計(jì)
- 重慶食品鈣生產(chǎn)線項(xiàng)目可行性研究報(bào)告(模板范文)
- 香料企業(yè)經(jīng)營(yíng)管理方案
- 2025至2030年中國(guó)玩具模型機(jī)床行業(yè)投資前景及策略咨詢報(bào)告
- 2025至2030年中國(guó)牛筋索行業(yè)投資前景及策略咨詢報(bào)告
- 2025至2030年中國(guó)火炎燒入鋼行業(yè)投資前景及策略咨詢報(bào)告
- 2025至2030年中國(guó)液壓管件接頭行業(yè)投資前景及策略咨詢報(bào)告
- 抖音直播運(yùn)營(yíng)策劃部門(mén)職責(zé)及績(jī)效考核指標(biāo)
- 2024江蘇揚(yáng)州市高郵市交通產(chǎn)業(yè)投資集團(tuán)有限公司招聘17人筆試備考題庫(kù)及答案解析
- 手術(shù)室患者體位管理課件
- 2024年高一生物學(xué)考模擬卷01
- 北京市豐臺(tái)區(qū)2023-2024學(xué)年五年級(jí)下學(xué)期期末英語(yǔ)試題
- 椎旁小關(guān)節(jié)病變影像診斷
- 2024年中國(guó)南水北調(diào)集團(tuán)水網(wǎng)智慧科技限公司秋季公開(kāi)招聘高頻考題難、易錯(cuò)點(diǎn)模擬試題(共500題)附帶答案詳解
- MOOC 臨床生物化學(xué)檢驗(yàn)技術(shù)-杭州醫(yī)學(xué)院 中國(guó)大學(xué)慕課答案
- JJG 705-2014液相色譜儀行業(yè)標(biāo)準(zhǔn)
- 酸嘢商業(yè)計(jì)劃書(shū)
- 煙草制品購(gòu)銷員(三級(jí))理論考試復(fù)習(xí)題庫(kù)(濃縮500題)
評(píng)論
0/150
提交評(píng)論