76 lines
1.6 KiB
C#
76 lines
1.6 KiB
C#
using System.Collections;
|
|
|
|
namespace _2023._09._25;
|
|
|
|
class Program
|
|
{
|
|
|
|
static void Feladat1()
|
|
{
|
|
ArrayList szamok = new ArrayList();
|
|
Random rnd = new Random();
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
{
|
|
szamok.Add(rnd.Next(1, 1001));
|
|
}
|
|
|
|
System.Console.WriteLine(szamok.Capacity);
|
|
System.Console.WriteLine(szamok.Count);
|
|
szamok.Sort();
|
|
System.Console.WriteLine("-------------------------------");
|
|
|
|
foreach (int item in szamok)
|
|
{
|
|
System.Console.WriteLine(item);
|
|
}
|
|
|
|
szamok.Reverse();
|
|
System.Console.WriteLine("-------------------------------");
|
|
|
|
foreach (int item in szamok)
|
|
{
|
|
System.Console.WriteLine(item);
|
|
}
|
|
}
|
|
|
|
static void Feladat2()
|
|
{
|
|
ArrayList ev = new ArrayList();
|
|
ArrayList ho = new ArrayList();
|
|
ArrayList nap = new ArrayList();
|
|
ArrayList ora = new ArrayList();
|
|
ArrayList perc = new ArrayList();
|
|
|
|
System.Console.WriteLine("Adja meg a dátumot:");
|
|
string datum = Console.ReadLine();
|
|
|
|
do
|
|
{
|
|
try
|
|
{
|
|
Console.Clear();
|
|
string[] elemek = datum.Split(":");
|
|
ev.Add(elemek[0]);
|
|
ho.Add(elemek[1]);
|
|
nap.Add(elemek[2]);
|
|
ora.Add(elemek[3]);
|
|
perc.Add(elemek[4]);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
Feladat2();
|
|
}
|
|
}
|