forked from kovacsrud/asztali_12
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca89e219d2 | ||
|
|
62c2abf0a0 | ||
|
|
4fc7a99164 |
25
Oop_alapok/Oop_alapok.sln
Normal file
25
Oop_alapok/Oop_alapok.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
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}") = "Oop_alapok", "Oop_alapok\Oop_alapok.csproj", "{B08627D4-6355-4E2C-A236-6AC983CA0A2D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B08627D4-6355-4E2C-A236-6AC983CA0A2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B08627D4-6355-4E2C-A236-6AC983CA0A2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B08627D4-6355-4E2C-A236-6AC983CA0A2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B08627D4-6355-4E2C-A236-6AC983CA0A2D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E52665CC-2E06-4F6D-8D21-EEF217DF7E7C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
52
Oop_alapok/Oop_alapok/Ember.cs
Normal file
52
Oop_alapok/Oop_alapok/Ember.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oop_alapok
|
||||
{
|
||||
public class Ember
|
||||
{
|
||||
//adattag, field
|
||||
string vezeteknev;
|
||||
string keresztnev;
|
||||
int szuletesiEv;
|
||||
string lakhely;
|
||||
|
||||
|
||||
//konstruktor, a neve meg kell hogy egyezzen az osztály nevével
|
||||
//nem void és visszatérési értéke sincsen
|
||||
//a példányosításkor automatikusan lefut
|
||||
public Ember(string vezeteknev,string keresztnev,int szuletesiev,string lakohely)
|
||||
{
|
||||
this.vezeteknev = vezeteknev;
|
||||
this.keresztnev = keresztnev;
|
||||
lakhely = lakohely;
|
||||
szuletesiEv = szuletesiev;
|
||||
}
|
||||
|
||||
public void Hello()
|
||||
{
|
||||
Console.WriteLine($"Hello,{vezeteknev} {keresztnev} vagyok.");
|
||||
}
|
||||
|
||||
public void SetVezetekNev( string vezeteknev)
|
||||
{
|
||||
if (vezeteknev.Length>2)
|
||||
{
|
||||
this.vezeteknev = vezeteknev;
|
||||
} else
|
||||
{
|
||||
throw new ArgumentException("A név min 3 karakter!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string GetVezeteknev()
|
||||
{
|
||||
return this.vezeteknev;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
55
Oop_alapok/Oop_alapok/JobbEmber.cs
Normal file
55
Oop_alapok/Oop_alapok/JobbEmber.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oop_alapok
|
||||
{
|
||||
public class JobbEmber
|
||||
{
|
||||
|
||||
|
||||
public string VezetekNev { get; set; }
|
||||
public string Keresztnev { get; set; }
|
||||
|
||||
private int szuletesiev;
|
||||
public int SzuletesiEv {
|
||||
get { return szuletesiev; }
|
||||
set {
|
||||
if (value>=1920 && value<=DateTime.Now.Year)
|
||||
{
|
||||
szuletesiev = value;
|
||||
} else
|
||||
{
|
||||
throw new ArgumentException("Hibás születési év!");
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Lakhely { get; set; }
|
||||
|
||||
|
||||
//overloading
|
||||
public JobbEmber()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Property
|
||||
public JobbEmber(string vezetekNev, string keresztnev, int szuletesiEv, string lakhely)
|
||||
{
|
||||
VezetekNev = vezetekNev;
|
||||
Keresztnev = keresztnev;
|
||||
SzuletesiEv = szuletesiEv;
|
||||
Lakhely = lakhely;
|
||||
}
|
||||
|
||||
public int GetEletkor()
|
||||
{
|
||||
return DateTime.Now.Year - SzuletesiEv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
Oop_alapok/Oop_alapok/Oop_alapok.csproj
Normal file
10
Oop_alapok/Oop_alapok/Oop_alapok.csproj
Normal 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>
|
||||
36
Oop_alapok/Oop_alapok/Program.cs
Normal file
36
Oop_alapok/Oop_alapok/Program.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace Oop_alapok
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Oop alapok");
|
||||
|
||||
|
||||
Ember ember = new Ember("Kiss","Elek",1988,"Gyula");
|
||||
Ember masikEmber = new Ember("Kósa","Márton",2001,"Orosháza");
|
||||
|
||||
ember.Hello();
|
||||
//ember.vezeteknev = "Kiss";
|
||||
//ember.keresztnev = "Egon";
|
||||
ember.SetVezetekNev("Köteles");
|
||||
|
||||
ember.Hello();
|
||||
|
||||
Console.WriteLine(ember.GetVezeteknev());
|
||||
|
||||
JobbEmber jobbEmber = new JobbEmber
|
||||
{
|
||||
VezetekNev="Nagy",
|
||||
Keresztnev="Amália",
|
||||
Lakhely="Miskolc",
|
||||
SzuletesiEv=1999
|
||||
};
|
||||
|
||||
JobbEmber masikJobbEmber = new JobbEmber("Komáromi", "Zoltán", 1976, "Békéscsaba");
|
||||
|
||||
|
||||
Console.WriteLine(masikJobbEmber.GetEletkor());
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Tombok/Tombok.sln
Normal file
25
Tombok/Tombok.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
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}") = "Tombok", "Tombok\Tombok.csproj", "{EEAB85F6-5992-46C5-9153-943E22221D79}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EEAB85F6-5992-46C5-9153-943E22221D79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EEAB85F6-5992-46C5-9153-943E22221D79}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EEAB85F6-5992-46C5-9153-943E22221D79}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EEAB85F6-5992-46C5-9153-943E22221D79}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A12116D7-49DA-4B2D-9C90-57B2A39A7DE4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
2
Tombok/Tombok/Program.cs
Normal file
2
Tombok/Tombok/Program.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
10
Tombok/Tombok/Tombok.csproj
Normal file
10
Tombok/Tombok/Tombok.csproj
Normal 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>
|
||||
10
Tombok2/Fuggvenyek/Fuggvenyek.csproj
Normal file
10
Tombok2/Fuggvenyek/Fuggvenyek.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
54
Tombok2/Fuggvenyek/Program.cs
Normal file
54
Tombok2/Fuggvenyek/Program.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
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 Kiir(string szoveg1, string szoveg2) {
|
||||
|
||||
Console.WriteLine(szoveg1+" "+szoveg2);
|
||||
|
||||
}
|
||||
|
||||
//visszatérési értékkel rendelkező függvény
|
||||
static int Osszead(int a,int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
static double Osszead(double a, double b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
//Írjon egy függvényt, amely három paramétert kap híváskor (ev,honap,nap)
|
||||
//A függvény egy string-típusú dátum értéket adjon vissza, pl. 2014.10.15
|
||||
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
Kiir();
|
||||
Kiir("Bármi");
|
||||
Kiir("Kiss", "Elek");
|
||||
|
||||
Console.WriteLine(Osszead(12, 45));
|
||||
int osszeg = Osszead(34, 78);
|
||||
Console.WriteLine(osszeg);
|
||||
|
||||
Console.WriteLine(Osszead(12.67, 45.3345));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Tombok2/Plus/Plus.csproj
Normal file
10
Tombok2/Plus/Plus.csproj
Normal 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
14
Tombok2/Plus/Program.cs
Normal 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
30
Tombok2/Tomb2d/Program.cs
Normal 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
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Tombok2/Tomb2d/Tomb2d.csproj
Normal file
10
Tombok2/Tomb2d/Tomb2d.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
43
Tombok2/Tombok2.sln
Normal file
43
Tombok2/Tombok2.sln
Normal 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
|
||||
58
Tombok2/Tombok2/Program.cs
Normal file
58
Tombok2/Tombok2/Program.cs
Normal 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}");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Tombok2/Tombok2/Tombok2.csproj
Normal file
10
Tombok2/Tombok2/Tombok2.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user