Vous êtes sur la page 1sur 2

using System; using System.Collections.Generic; using System.

Text; namespace __dimensional_array { class Program { static void Main(string[] args) { int[] myArray = new int[10]; //<<<---declaration of an array variabl e myArray[0] myArray[1] myArray[2] myArray[3] myArray[4] myArray[5] myArray[6] myArray[7] myArray[8] myArray[9] Console.WriteLine("Values inside the variable myArray"); Console.WriteLine(""); //'<----{This section shows the items inside your myArray variable} ---->' Console.WriteLine("The value of //'<--this is the method for accessing Console.WriteLine("The value of //' the value of an array Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of //'<----{This section shows the ' myArray[0] myArray[1] myArray[2] myArray[3] myArray[4] myArray[5] myArray[6] myArray[7] myArray[8] myArray[9] = = = = = = = = = = 11*1; 22 * 2; 33 * 3; 44*4; 55*5; 66*6; 77*7; 88*8; 99*9; 10*10; myArray at index 0 is :" + myArray[0]); myArray at index 1 is :" + myArray[1]); myArray at index 2 is :" + myArray[2]); myArray at index 3 is :" + myArray[3]); myArray at index 4 is :" + myArray[4]); myArray at index 5 is :" + myArray[5]); myArray at index 6 is :" + myArray[6]); myArray at index 7 is :" + myArray[7]); myArray at index 8 is :" + myArray[8]); myArray at index 9 is :" + myArray[9]); items inside your myArray variable}----> = = = = = = = = = = 11; 22; 33; 44; 55; 66; 77; 88; 99; 10; //'----------------------------------------// This is the method of adding an item // for a 1 dimensional array // // // // // // //'-----------------------------------------

//'----------------------------------------// Another way of adding data to an array // it can be from the answer of an operation // // // // // // //'------------------------------------------

Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("New values inside the variable myArray");

Console.WriteLine(""); //'<----{This section shows the items inside your myArray variable}----> ' Console.WriteLine("The value of //'<--this is the method for accessing Console.WriteLine("The value of //' the value of an array Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of Console.WriteLine("The value of //'<----{This section shows the ' Console.Read(); } } } myArray at index 0 is :" + myArray[0]); myArray at index 1 is :" + myArray[1]); myArray at index 2 is :" + myArray[2]); myArray at index 3 is :" + myArray[3]); myArray at index 4 is :" + myArray[4]); myArray at index 5 is :" + myArray[5]); myArray at index 6 is :" + myArray[6]); myArray at index 7 is :" + myArray[7]); myArray at index 8 is :" + myArray[8]); myArray at index 9 is :" + myArray[9]); items inside your myArray variable}---->

Vous aimerez peut-être aussi