Programozás gyakorlat
Random rnd = new Random();
int veletlen = rnd.Next(1, 13);
Console.WriteLine(veletlen);
Console.ReadKey();
Console.WriteLine(DateTime.Now);
Console.WriteLine(DateTime.Today);
var most = DateTime.Now;
Console.WriteLine("{0:d}",most);
Console.WriteLine("{0:D}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
int[] a = { 1,3,2,4,56,7,34};
foreach (int b in a)
{
Console.WriteLine(b);
}
Console.WriteLine(a.Max());
Console.WriteLine(a.Min());
Console.WriteLine(a.Length);
Array.Sort<int>(a);
foreach(int c in a)
{
Console.WriteLine(c);
}
string[] sz = { "ccc", "bbb", "aaa" };
foreach(string t in sz)
{
Console.WriteLine(t);
}
Array.Sort(sz);
foreach (string t in sz)
{
Console.WriteLine(t);
}
int ido = 1000;
for (int zz = 0; zz < 100; zz++)
{
System.Threading.Thread.Sleep(ido);
Console.BackgroundColor = ConsoleColor.Red;
Console.Clear();
System.Threading.Thread.Sleep(ido);
Console.BackgroundColor = ConsoleColor.Blue;
Console.Clear();
ido = ido - 50;
}
Console.ReadKey();
Random rnd = new Random();
int veletlen = rnd.Next(1, 13);
Console.WriteLine(veletlen);
Console.ReadKey();
Console.WriteLine(DateTime.Now);
Console.WriteLine(DateTime.Today);
var most = DateTime.Now;
Console.WriteLine("{0:d}",most);
Console.WriteLine("{0:D}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
Console.WriteLine("{0:d}", most);
int[] a = { 1,3,2,4,56,7,34};
foreach (int b in a)
{
Console.WriteLine(b);
}
Console.WriteLine(a.Max());
Console.WriteLine(a.Min());
Console.WriteLine(a.Length);
Array.Sort<int>(a);
foreach(int c in a)
{
Console.WriteLine(c);
}
string[] sz = { "ccc", "bbb", "aaa" };
foreach(string t in sz)
{
Console.WriteLine(t);
}
Array.Sort(sz);
foreach (string t in sz)
{
Console.WriteLine(t);
}
int ido = 1000;
for (int zz = 0; zz < 100; zz++)
{
System.Threading.Thread.Sleep(ido);
Console.BackgroundColor = ConsoleColor.Red;
Console.Clear();
System.Threading.Thread.Sleep(ido);
Console.BackgroundColor = ConsoleColor.Blue;
Console.Clear();
ido = ido - 50;
}
Console.ReadKey();
Nincsenek megjegyzések:
Megjegyzés küldése