سلام دوستان عزیز . در این تاپیک ، کد آرایه دندانه دار (Jagged Array) در سی شارپ C#.NET رو براتون آماده کردم.
using System;.
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ram
{
class Program
{
static void Main(string[] args)
{
int[][] A = new int[3][];
A[0] = new int[5] {
23,
34,
43,
12,
89
};
A[1] = new int[4] {
87,
76,
90,
98
};
A[2] = new int[6] {
34,
5,
6,
8,
76,
98
};
Console.WriteLine("elements of jagged array are :-");
foreach(int[] i in A) {
foreach(int j in i) {
Console.Write(j + " ");
}
Console.WriteLine();
}
Console.Read();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ram
{
class Program
{
static void Main(string[] args)
{
int[][] A = new int[3][];
A[0] = new int[5] {
23,
34,
43,
12,
89
};
A[1] = new int[4] {
87,
76,
90,
98
};
A[2] = new int[6] {
34,
5,
6,
8,
76,
98
};
Console.WriteLine("elements of jagged array are :-");
foreach(int[] i in A) {
foreach(int j in i) {
Console.Write(j + " ");
}
Console.WriteLine();
}
Console.Read();
}
}
}
در پناه حق پیروز و موفق باشید