This commit is contained in:
2022-05-22 17:11:48 +02:00
parent bc5fba8a18
commit b85b136ae6
24 changed files with 10132 additions and 1000007 deletions

Binary file not shown.

View File

@@ -1024,10 +1024,10 @@ namespace BaratFajl {
StreamWriter writer = new StreamWriter(@"baratok.txt", false, Encoding.Default);
for (int i = 0; i < 1000000; i++) {
for (int i = 0; i < 10000; i++) {
if (i % 100000 == 0) Console.WriteLine(i + " kiirva");
int nev_random = gen.Next(0, 1000);
int bulizasi_hajlam = gen.Next(1, 101);
int bulizasi_hajlam = gen.Next(1, 11);
writer.WriteLine(nevek[nev_random] + "," + RandomDay().ToShortDateString() + "," + "n," + bulizasi_hajlam);
}
writer.Close();

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -18,6 +18,18 @@ namespace BaratLista {
this.bulizasi_szam = b_szam;
}
public DateTime getSzuletes() {
return szuletes_ido;
}
public string getNev() {
return nev;
}
public int getBulizasi_szam() {
return bulizasi_szam;
}
public void kiir() {
string ido = szuletes_ido.ToShortDateString();
Console.WriteLine("Név: " + nev + "\tSzületési idő: " + ido + "\tNem: " + nem + "\tBulizasi szam: " + bulizasi_szam);

View File

@@ -44,6 +44,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Barat.cs" />
<Compile Include="Konzol.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>

66
BaratLista/Konzol.cs Normal file
View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaratLista {
public static class Konzol {
public static int index = 0;
private static int count;
private static ConsoleKeyInfo key;
public static void getCount(int listCount) {
count = listCount;
}
public static void kiir(List<Barat> list) {
//20 adat kiirasa
int tartomany = index + 20;
for (int i = index; i < tartomany; i++) {
Console.Write((i+1) + "\t");
list[i].kiir();
}
}
public static void ReadKey() {
//Gomb beolvasasa
key = Console.ReadKey();
Console.WriteLine(key.Key);
System.Threading.Thread.Sleep(2000);
}
public static void dontes() {
if (key.Key == ConsoleKey.PageUp) {
fel();
} else if (key.Key == ConsoleKey.PageDown) {
le();
} else if (key.Key == ConsoleKey.Home) {
home();
} else if (key.Key == ConsoleKey.End) {
end();
} else if (key.Key == ConsoleKey.Delete) {
Program.buli();
} else
Console.WriteLine("Nem jo gombot nyomott le!!");
}
private static void fel() {
index++;
if (index == count - 19) index = count - 20;
}
private static void le() {
index--;
if (index < 0) index = 0;
}
private static void home() {
index = 0;
}
private static void end() {
index = count - 20;
}
}
}

View File

@@ -7,11 +7,50 @@ using System.IO;
namespace BaratLista {
public class Program {
static void Main(string[] args) {
public static List<Barat> baratok = new List<Barat>();
public static void buli() {
int ev = DateTime.Now.Year - 20;
List<Barat> nevek = new List<Barat>();
for (int i = 0; i < baratok.Count; i++) {
if (baratok[i].getSzuletes().Year < ev && baratok[i].getBulizasi_szam() >= 5) {
if(nevek.Count != 15) {
nevek.Add(baratok[i]);
} else {
int min = 11;
int min_i = -1;
for (int j = 0; j < nevek.Count; j++) {
if (nevek[j].getBulizasi_szam() < min) {
min = nevek[j].getBulizasi_szam();
min_i = j;
}
}
nevek.RemoveAt(min_i);
nevek.Add(baratok[i]);
}
}
}
if(nevek.Count > 9) {
for (int i = 0; i < nevek.Count; i++) {
Console.WriteLine(nevek[i].getNev());
}
} else {
Console.WriteLine("Nincs eleg ember a bulizashoz");
}
Console.WriteLine("Folytatashoz nyomjon meg egy gombot");
Console.ReadKey();
}
public static void Main() {
//fajl letrehozasa
BaratFajl.Program.Main();
List<Barat> baratok = new List<Barat>();
//fajl beolvasasa
StreamReader reader = new StreamReader("baratok.txt", Encoding.Default);
int c = 0;
while(!reader.EndOfStream) {
@@ -22,12 +61,19 @@ namespace BaratLista {
baratok.Add(new Barat(adatok[0], DateTime.Parse(adatok[1]), adatok[2], Convert.ToInt32(adatok[3])));
}
for (int i = 0; i < baratok.Count; i++) {
if (c % 100000 == 0)
baratok[i].kiir();
}
//main loop
Konzol.getCount(baratok.Count);
while (true) {
Console.Clear();
Console.WriteLine("A PageUp es PageDown gombokkal tud lepkedni a megjelenitendo sorokon");
Console.WriteLine("A Home es End gombokkal a lista elejere es vegere tud lepni");
Console.WriteLine("A Del gomb megnyomasaval meg tudja nezni van e eleg fo egy bulihoz");
Console.WriteLine("Egy gomb megnyomasa utan a program 2 mp-t fog varni\n");
Console.ReadKey();
Konzol.kiir(baratok);
Konzol.ReadKey();
Konzol.dontes();
}
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
f7a94ccdee24e0c21663094986c63ce7832ac100
8095570ecc3df601000f11556c753de6164fd09d

Binary file not shown.

Binary file not shown.