added orai
This commit is contained in:
57
20240131_doga_B/ConsoleApp1/Program.cs
Normal file
57
20240131_doga_B/ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
public class Uzenet
|
||||
{
|
||||
public string nev;
|
||||
public int ora, perc, adasdb;
|
||||
|
||||
public Uzenet(int ora, int perc, int adasdb, string nev)
|
||||
{
|
||||
this.ora = ora;
|
||||
this.perc = perc;
|
||||
this.adasdb = adasdb;
|
||||
this.nev = nev;
|
||||
}
|
||||
}
|
||||
class Program
|
||||
{
|
||||
public static int Feladat3(List<Uzenet> adatok)
|
||||
{
|
||||
return adatok.Count;
|
||||
}
|
||||
public static int Feladat4(List<Uzenet> adatok)
|
||||
{
|
||||
return adatok.Count;
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
List<Uzenet> adatok = new List<Uzenet>();
|
||||
|
||||
FileStream fileStream = new FileStream("cb.txt", FileMode.Open, FileAccess.Read);
|
||||
StreamReader streamReader = new StreamReader(fileStream);
|
||||
|
||||
string[] data = streamReader.ReadToEnd().Split('\n');
|
||||
|
||||
streamReader.Close();
|
||||
fileStream.Close();
|
||||
|
||||
|
||||
for (int i = 1; i < data.Length - 1; i++)
|
||||
{
|
||||
string[] sor = data[i].Split(';');
|
||||
Uzenet uzi = new Uzenet(int.Parse(sor[0]), int.Parse(sor[1]), int.Parse(sor[2]), sor[3]);
|
||||
adatok.Add(uzi);
|
||||
}
|
||||
|
||||
Console.WriteLine($"3. feladat: Bejegyzések száma: {Feladat3(adatok)}");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user