Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

A Level Computer Science Programming Guide/Arrays

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Declaring Arrays In Pseudocode, Arrays all have declarable Upper and Lower bounds. In VB.NET, Arrays all have declarable Upper Bounds, but Lower Bounds are always 0. One Dimensional Arrays LanguageGeneral UsageExample UsagePseudocodeDECLARE <Identifier> : ARRAY[<Lower Bound>:<Upper Bound>] OF <Data Type>DECLARE NameList : ARRAY[1:5] OF STRING DECLARE YearlyRainfall : ARRAY[1900:2100] OF REAL DECLARE AgeList : ARRAY[0:40] OF INTEGERVB.NETDim <Identifier>(<Upper Bound>) As <Data Type>Dim NameList(4) As String Dim YearlyRainfall(200) As Double Dim AgeList(40) As IntegerPython<Identifier> = []NameList = [] YearlyRainfall = [] AgeList = [] Two Dimensional Arrays LanguageGeneral UsageExample UsagePseudocodeDECLARE <Identifier> : ARRAY[<Lower Bound>:<Upper Bound>, <Lower Bound>:<Upper Bound>] OF <Data Type>DECLARE GameArea : ARRAY[1:32, 0:16] OF STRING DECLARE SudokuGrid : ARRAY[1:9, 1:9] OF INTEGER DECLARE PopulationDensity : ARRAY[1:50, 20:50] OF REALVB.NETDim <Identifier>(<Upper Bound>, <Upper Bound>) As <Data Type>Dim GameArea(31, 16) As String Dim SudokuGrid(8) As Integer Dim PopulationDensity(49,30) As DoublePython<Identifier1> = [] <Identifier2> = [] <Identifier1>.append(<Identifier2>)Game = [] GameArea = [] GameArea.append(Game) SudokuX = [] SudokuGrid = [] SudokuGrid.append(SudokuX) Longitude = [] PopulationDensity = [] PopulationDensity.append(Longitude) Using Arrays One Dimensional Arrays LanguageGeneral UsageExample UsagePseudocode<Identifier>[<Index>] ← <Value>NameList[1] ← "Stephen" YearlyRainfall[1985] ← 13.73 AgeList[39] ← 17VB.NET<Identifier>(<Index>) = <Value>NameList(0) = "Stephen" YearlyRainfall(85) = 13.73 AgeList(38) = 17Python<Identifier>.append(<Value>)NameList.append("Stephen") YearlyRainfall.append(13.73) AgeList.append(17) Two Dimensional Arrays LanguageGeneral UsageExample UsagePseudocode<Identifier>[<Index>,<Index>] ← <Value>GameArea[16, 5] ← "Fire" SudokuGrid[9, 3] ← 7 PopulationDensity[14, 32] ← 242.023VB.NET<Identifier>(<Index>,<Index>) = <Value>GameArea(15, 5) = "Fire" SudokuGrid(8, 2) = 7 PopulationDensity(13, 12) = 242.023Python<Identifier1> = [] <Identifier2> = [] <Identifier1>.append(<Identifier2>)Game.append("Fire") GameArea.append(Game) SudokoX.append(7) SudokuGrid.append(SudokuX) Longitude.append(242.023) PopulationDensity.append(Longitude)