2d tömbök

This commit is contained in:
Kovács Rudolf
2026-10-06 14:00:37 +02:00
parent d1bfba7cfb
commit 2bb8c6f9c0
3 changed files with 51 additions and 0 deletions

View 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>

View 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
}
}
}

View File

@@ -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>