2d tömbök
This commit is contained in:
10
Tombok/KetDimenziosTombok/KetDimenziosTombok.csproj
Normal file
10
Tombok/KetDimenziosTombok/KetDimenziosTombok.csproj
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
40
Tombok/KetDimenziosTombok/Program.cs
Normal file
40
Tombok/KetDimenziosTombok/Program.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
namespace KetDimenziosTombok
|
||||||
|
{
|
||||||
|
internal class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Kétdimenziós tömbök");
|
||||||
|
int[,] szamok = new int[10, 20];
|
||||||
|
Random rand= new Random();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < szamok.GetLength(0); i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < szamok.GetLength(1); j++)
|
||||||
|
{
|
||||||
|
szamok[i, j] = rand.Next(10, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < szamok.GetLength(0); i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j< szamok.GetLength(1); j++)
|
||||||
|
{
|
||||||
|
Console.Write(szamok[i,j]+" ");
|
||||||
|
}
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"Sorok:{szamok.GetLength(0)},Oszlopok:{szamok.GetLength(1)}");
|
||||||
|
|
||||||
|
Console.WriteLine(szamok.Length);
|
||||||
|
|
||||||
|
//Hozzon létre egy kétdimenziós tömböt, ahol az elemek típusa char
|
||||||
|
//A tömböt töltse fel egy tetszőleges karakterrel
|
||||||
|
//A tömb egy véletlenszerűen kiválaszott elemébe írjon be egy * karaktert
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
|
<Project Path="KetDimenziosTombok/KetDimenziosTombok.csproj" Id="6ada30d5-9f79-4936-a7c7-e5939f15b7fd" />
|
||||||
<Project Path="Tombok/Tombok.csproj" />
|
<Project Path="Tombok/Tombok.csproj" />
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|||||||
Reference in New Issue
Block a user