cSharp learning course

using System;
using System.Linq;


public class Program
{
public static void Main()
{
int[][,] jaggedArr = new int [3][,];

jaggedArr[0] = new int[,] {{1,2},{3,4}};
jaggedArr[1] = new int[,] {{5,6},{7,8}};
jaggedArr[2] = new int[,] {{9,10},{11,12}};

Console.WriteLine(jaggedArr[1][0,0]);
jaggedArr[1][0,0] = 6;
Console.WriteLine(jaggedArr[1][0,0]);


int[][,] jagged2 =
{
new int [,]{{1,2},{3,4}},
new int [,] {{5,6},{7,8}},
new int [,] {{9,10},{11,12}}
};

Console.WriteLine(jagged2[1][0,0]);
jagged2[1][0,0] = 6;
Console.WriteLine(jagged2[1][0,0]);

int[] myTab = new int [5];

for (int i = 0; i < myTab.Length;i++)
{
myTab[i] = i;
}
foreach (int i in myTab)
{
Console.WriteLine(i);

};

Console.WriteLine(myTab.Max());
Console.WriteLine(myTab.Min());
Console.WriteLine(myTab.Average());

int [,] mTab = new int [2,2];
mTab[0,0] = 1;
Console.WriteLine("mTab[0,0] = {0}",mTab[0,0]);



//or
int [][] mTaba = new int [2][];
mTaba[0] = new int[] {1};
Console.WriteLine("mTaba[0][0] = {0}", mTaba[0][0]);

}
}

© 2013-2024 PRV.pl
Strona zostaƂa stworzona kreatorem stron w serwisie PRV.pl