.


:




:

































 

 

 

 


. numsl: 0123456789




numsl: 0123456789

nums2: 0 -1 -2 -3 -4 -5 -6 -7 -8 -9

nums2

: 0123456789 numsl nums2: 012 99 456789

, nums 2 numsl .

Length

C# . , Length, , . , , . , .

// Length .

Using System;

class LengthDemo { static void Main() {

int[] nums = new int[10];

Console.WriteLine(" nums " + nums.Length);

// Length nums. for(int i=0; i < nums.Length; i++) nums[i] = i * i;

// Length // nums.

Console.Write(" nums: "); for(int i=0; i < nums.Length; i++)

Console.Write(nums[i] + " ");

Console.WriteLine();

}

}

.

nums 10

nums: 0 1 4 9 16 25 36 49 64 81

, LengthDemo nums. Length for . , . , , , Length , . Length , .

, , , .

// Length .

Using System;

class LengthDemo3D { static void Main() {

int[,,] nums = new int[10, 5, 6];

Console.WriteLine(" nums " + nums.Length);

}

}

.

nums 300

, Length , ( 300 (10><56) ). Length .

Length , , . Length , .

// .

Using System;

class RevCopy {

static void Main() { int i,j;

int[] numsl = new int[10]; int[] nums2 = new int[10];

for(i=0; i < numsl.Length; i++) numsl[i] = i;

Console.Write(" : "); for(i=0; i < nums2.Length; i++)

Console.Write(numsl[i] + " ");

Console.WriteLine();

// numsl nums2 , if(nums2.Length >= numsl.Length) // ,

// nums2 for(i=0, j=numsl.Length-1; i < numsl.Length; i++, j--) nums2[j] = numsl[i];

Console.Write(" : "); for(i=0; i < nums2.Length; i++)

Console.Write(nums2[i] + " ");

.

: 0123456789 : 9876543210

Length . -, , . -, for, . , Length, , .

Length

Length . , . , () , .

// Length // .

Using System;

class Jagged {

static void Main() {

int[][] network_nodes = new int[4][]; network_nodes[0] = new int[3]; network_nodes[1] = new int[7]; network_nodes[2] = new int[2]; network_nodes[3] = new int[5];

Int i, j;

// . for(i=0; i < network_nodes.Length; i++)

for(j=0; j < network_nodes[i].Length; j++) network_nodes[i][j] = i * j + 70;

Console.WriteLine(" : " + network_nodes.Length + "\n");

for(i=0; i < network_nodes.Length; i++) {

for(j=0; j < network_nodes[i].Length; j++) {

Console.Write(" " + i +

" " + j + ": ");

Console.Write(network_nodes[i][j] + "% ");

Console.WriteLine ();

}





:


: 2016-12-03; !; : 355 |


:

:

.
==> ...

1281 - | 1263 -


© 2015-2024 lektsii.org - -

: 0.011 .