欢迎来到天天文库
浏览记录
ID:6031808
大小:889.50 KB
页数:45页
时间:2017-12-25
《江苏新宁现代物流股份有限公司》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、ArraysObjectivesDeclareandinitializeaone-dimensionalarrayStoredatainaone-dimensionalarrayDisplaythecontentsofaone-dimensionalarrayCodealoopusingtheForEach…NextstatementAccessanelementinaone-dimensionalarraySearchaone-dimensionalarrayComputetheaverageofaone-dimensionalarray’scontentsFindthehig
2、hestentryinaone-dimensionalarrayUpdatethecontentsofaone-dimensionalarraySortaone-dimensionalarrayObjectives(cont’d)Createandmanipulateparallelone-dimensionalarraysCreateastructureDeclareastructurevariableCreateandmanipulateaone-dimensionalarrayofstructuresCreateandinitializeatwo-dimensionalar
3、rayStoredatainatwo-dimensionalarraySearchatwo-dimensionalarrayArraysAsimpleorscalarvariableisonethatisunrelatedtoanyothervariableinmemoryAnarrayisagroupofvariablesthathavethesamenameanddatatypeandarerelatedinsomewayArrays(continued)Themostcommonlyusedarraysareone-dimensionalandtwo-dimensional
4、ProgrammersusearraystostorerelateddataintheinternalmemoryofthecomputerOne-DimensionalArraysAone-dimensionalarrayissimplyarow(orcolumn)ofvariablesEachelementinanarrayisidentifiedbyasubscript,whichVisualBasic.NETassignstothevariablewhenthearrayiscreatedOne-DimensionalArrays(continued)Youreferto
5、eachvariableinanarraybyitsnameandthevariable’ssubscriptNamesofthevariablesinaone-dimensionalarraynamedstatesOne-DimensionalArrays(continued)Declaringaone-dimensionalarrayVersion1{Dim
6、Private}arrayname(highestSubscript)AsdatatypeVersion2{Dim
7、Private}arrayname()Asdatatype={initialValues}One-Dim
8、ensionalArrays(continued)ExamplesofdeclaringanarrayDimcities(3)AsStringPrivatestates()AsString={“Hawaii”,“Alaska”,“Maine”}StoringDatainaOne-DimensionalArrayInmostcases,youuseanassignmentstatementtoenterdataintoanexistingarraySyntax:arrayname(subscript)=valueExamplescities(0)=“Madrid”cities(1)
9、=“Paris”cities(2)=“Rome”ManipulatingOne-DimensionalArraysYouwilllearnhowtoperformthefollowingtasksusingaone-dimensionalarray:DisplaythecontentsofanarrayAccessanarrayelementusingitssubscriptSearchthearrayCalculatetheaverageofthedatastoredinanu
此文档下载收益归作者所有