added helsinki
This commit is contained in:
@@ -1,69 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApp2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static class MyData
|
||||
{
|
||||
public static ArrayList csaladnev = new ArrayList();
|
||||
public static ArrayList keresztnev = new ArrayList();
|
||||
public static ArrayList magassag = new ArrayList();
|
||||
public static ArrayList tomeg = new ArrayList();
|
||||
public static ArrayList nem = new ArrayList();
|
||||
}
|
||||
|
||||
static void Feladat1()
|
||||
{
|
||||
FileStream fs = new FileStream(@"C:\Users\szabomarton\Desktop\C#\20230920\ConsoleApp2\bin\Debug\tanulók.txt", FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string sor = sr.ReadLine();
|
||||
while (sor != null)
|
||||
{
|
||||
string[] temp = sor.Split(';');
|
||||
MyData.csaladnev.Add(temp[0]);
|
||||
MyData.keresztnev.Add(temp[1]);
|
||||
MyData.magassag.Add(Convert.ToByte(temp[2]));
|
||||
MyData.tomeg.Add(Convert.ToDouble(temp[3]));
|
||||
MyData.nem.Add(temp[4]);
|
||||
sor = sr.ReadLine();
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
foreach (string str in MyData.csaladnev)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
|
||||
foreach (string str in MyData.keresztnev)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.magassag)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.tomeg)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.nem)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Feladat1();
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApp2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static class MyData
|
||||
{
|
||||
public static ArrayList csaladnev = new ArrayList();
|
||||
public static ArrayList keresztnev = new ArrayList();
|
||||
public static ArrayList magassag = new ArrayList();
|
||||
public static ArrayList tomeg = new ArrayList();
|
||||
public static ArrayList nem = new ArrayList();
|
||||
}
|
||||
|
||||
static void Feladat1()
|
||||
{
|
||||
FileStream fs = new FileStream(@"C:\Users\szabomarton\Desktop\C#\20230920\ConsoleApp2\bin\Debug\tanulók.txt", FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string sor = sr.ReadLine();
|
||||
while (sor != null)
|
||||
{
|
||||
string[] temp = sor.Split(';');
|
||||
MyData.csaladnev.Add(temp[0]);
|
||||
MyData.keresztnev.Add(temp[1]);
|
||||
MyData.magassag.Add(Convert.ToByte(temp[2]));
|
||||
MyData.tomeg.Add(Convert.ToDouble(temp[3]));
|
||||
MyData.nem.Add(temp[4]);
|
||||
sor = sr.ReadLine();
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
foreach (string str in MyData.csaladnev)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
|
||||
foreach (string str in MyData.keresztnev)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.magassag)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.tomeg)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
foreach (string str in MyData.nem)
|
||||
{
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Feladat1();
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user