barat
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1024,10 +1024,10 @@ namespace BaratFajl {
|
|||||||
|
|
||||||
StreamWriter writer = new StreamWriter(@"baratok.txt", false, Encoding.Default);
|
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");
|
if (i % 100000 == 0) Console.WriteLine(i + " kiirva");
|
||||||
int nev_random = gen.Next(0, 1000);
|
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.WriteLine(nevek[nev_random] + "," + RandomDay().ToShortDateString() + "," + "n," + bulizasi_hajlam);
|
||||||
}
|
}
|
||||||
writer.Close();
|
writer.Close();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,6 +18,18 @@ namespace BaratLista {
|
|||||||
this.bulizasi_szam = b_szam;
|
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() {
|
public void kiir() {
|
||||||
string ido = szuletes_ido.ToShortDateString();
|
string ido = szuletes_ido.ToShortDateString();
|
||||||
Console.WriteLine("Név: " + nev + "\tSzületési idő: " + ido + "\tNem: " + nem + "\tBulizasi szam: " + bulizasi_szam);
|
Console.WriteLine("Név: " + nev + "\tSzületési idő: " + ido + "\tNem: " + nem + "\tBulizasi szam: " + bulizasi_szam);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Barat.cs" />
|
<Compile Include="Barat.cs" />
|
||||||
|
<Compile Include="Konzol.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
66
BaratLista/Konzol.cs
Normal file
66
BaratLista/Konzol.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,11 +7,50 @@ using System.IO;
|
|||||||
|
|
||||||
namespace BaratLista {
|
namespace BaratLista {
|
||||||
public class Program {
|
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();
|
BaratFajl.Program.Main();
|
||||||
|
|
||||||
List<Barat> baratok = new List<Barat>();
|
//fajl beolvasasa
|
||||||
|
|
||||||
StreamReader reader = new StreamReader("baratok.txt", Encoding.Default);
|
StreamReader reader = new StreamReader("baratok.txt", Encoding.Default);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while(!reader.EndOfStream) {
|
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])));
|
baratok.Add(new Barat(adatok[0], DateTime.Parse(adatok[1]), adatok[2], Convert.ToInt32(adatok[3])));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < baratok.Count; i++) {
|
//main loop
|
||||||
if (c % 100000 == 0)
|
Konzol.getCount(baratok.Count);
|
||||||
baratok[i].kiir();
|
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.
1009992
BaratLista/bin/Debug/baratok.txt
1009992
BaratLista/bin/Debug/baratok.txt
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1 +1 @@
|
|||||||
f7a94ccdee24e0c21663094986c63ce7832ac100
|
8095570ecc3df601000f11556c753de6164fd09d
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user