52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
|
namespace _2024._01._15;
|
||
|
|
||
|
class Toto
|
||
|
{
|
||
|
private FileStream Fs;
|
||
|
|
||
|
public Toto(FileStream fs)
|
||
|
{
|
||
|
Fs = fs;
|
||
|
}
|
||
|
|
||
|
// public void Feladat3()
|
||
|
// {
|
||
|
// StreamReader r = new StreamReader(Fs);
|
||
|
// string sor = r.ReadLine();
|
||
|
// int fordulok = 0;
|
||
|
|
||
|
// while (sor != null)
|
||
|
// {
|
||
|
// sor = r.ReadLine();
|
||
|
// fordulok++;
|
||
|
// }
|
||
|
|
||
|
// System.Console.WriteLine($"Fordulók száma: {fordulok - 1}");
|
||
|
// }
|
||
|
|
||
|
public void Feladat4()
|
||
|
{
|
||
|
StreamReader r = new StreamReader(Fs);
|
||
|
string sor = r.ReadLine();
|
||
|
int sor_szama = 0;
|
||
|
int telitalalatok = 0;
|
||
|
|
||
|
while (sor != null)
|
||
|
{
|
||
|
sor = r.ReadLine();
|
||
|
sor_szama++;
|
||
|
string[] lista = sor.Split(';');
|
||
|
if (sor_szama == 1)
|
||
|
{
|
||
|
continue;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
telitalalatok += int.Parse(lista[3]);
|
||
|
System.Console.WriteLine(lista[3]);
|
||
|
}
|
||
|
sor = r.ReadLine();
|
||
|
}
|
||
|
System.Console.WriteLine($"Telitalálatok száma: {telitalalatok} db");
|
||
|
}
|
||
|
}
|