Gyakorlás

This commit is contained in:
lego
2026-09-09 14:52:24 +02:00
parent aed00c3b52
commit 4fc7a99164
12 changed files with 248 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,26 @@
namespace Fuggvenyek
{
internal class Program
{
//Overloading, túlterhelés
static void Kiir()
{
Console.WriteLine("Valami");
}
static void Kiir(string szoveg)
{
Console.WriteLine(szoveg);
}
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Kiir();
Kiir("Bármi");
}
}
}

10
Tombok2/Plus/Plus.csproj Normal file
View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

14
Tombok2/Plus/Program.cs Normal file
View File

@@ -0,0 +1,14 @@
namespace Plus
{
internal class Program
{
static void Main(string[] args)
{
int a = 10;
int b = a++;
int c = ++a;
Console.WriteLine($"B:{b},C:{c}");
}
}
}

30
Tombok2/Tomb2d/Program.cs Normal file
View File

@@ -0,0 +1,30 @@
namespace Tomb2d
{
internal class Program
{
static void Main(string[] args)
{
int[,] tomb2d = new int[10, 12];
Random random = new Random();
for (int i = 0; i < tomb2d.GetLength(0); i++)
{
for (int j = 0; j < tomb2d.GetLength(1); j++)
{
tomb2d[i, j] = random.Next(10, 100);
}
}
for (int i = 0; i < tomb2d.GetLength(0); i++)
{
for (int j = 0; j < tomb2d.GetLength(1); j++)
{
Console.Write(tomb2d[i, j]+" ");
}
Console.WriteLine();
}
//összeg, min max
}
}
}

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

43
Tombok2/Tombok2.sln Normal file
View File

@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tombok2", "Tombok2\Tombok2.csproj", "{DCFB293E-5A24-4830-9A55-5B23BBC1BAFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plus", "Plus\Plus.csproj", "{8D559133-702B-4F41-B759-A5E8501493DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomb2d", "Tomb2d\Tomb2d.csproj", "{4A3190D4-96C4-44BE-86D6-8E423E239B18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fuggvenyek", "Fuggvenyek\Fuggvenyek.csproj", "{99E802E5-A809-48F8-A291-99AD7E68B0E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCFB293E-5A24-4830-9A55-5B23BBC1BAFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCFB293E-5A24-4830-9A55-5B23BBC1BAFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCFB293E-5A24-4830-9A55-5B23BBC1BAFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCFB293E-5A24-4830-9A55-5B23BBC1BAFF}.Release|Any CPU.Build.0 = Release|Any CPU
{8D559133-702B-4F41-B759-A5E8501493DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D559133-702B-4F41-B759-A5E8501493DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D559133-702B-4F41-B759-A5E8501493DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D559133-702B-4F41-B759-A5E8501493DB}.Release|Any CPU.Build.0 = Release|Any CPU
{4A3190D4-96C4-44BE-86D6-8E423E239B18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A3190D4-96C4-44BE-86D6-8E423E239B18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A3190D4-96C4-44BE-86D6-8E423E239B18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A3190D4-96C4-44BE-86D6-8E423E239B18}.Release|Any CPU.Build.0 = Release|Any CPU
{99E802E5-A809-48F8-A291-99AD7E68B0E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99E802E5-A809-48F8-A291-99AD7E68B0E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99E802E5-A809-48F8-A291-99AD7E68B0E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99E802E5-A809-48F8-A291-99AD7E68B0E8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {26681942-EC9E-4F69-AC5D-200773A43DDF}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,58 @@
namespace Tombok2
{
internal class Program
{
static void Main(string[] args)
{
int[] szamok = new int[100];
Random random = new Random();
for (int i = 0; i < szamok.Length; i++)
{
szamok[i] = random.Next(10, 100 + 1);
}
for (int i = 0; i < szamok.Length; i++)
{
Console.Write(szamok[i] + " ");
}
Console.WriteLine();
//összegzés
int osszeg = 0;
for (int i = 0; i < szamok.Length; i++)
{
osszeg += szamok[i];
}
Console.WriteLine($"Összeg:{osszeg},{szamok.Sum()}");
//megszámlálás
int darab = 0;
for (int i = 0; i < szamok.Length; i++)
{
darab += 1;
}
Console.WriteLine($"Darab:{darab},{szamok.Count()}");
//min, max
int min = szamok[0];
int max = szamok[0];
for (int i = 0; i < szamok.Length; i++)
{
if (szamok[i]<min)
{
min = szamok[i];
}
if (szamok[i]>max)
{
max = szamok[i];
}
}
Console.WriteLine($"Min:{min},Max:{max}");
}
}
}

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>