using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace ConsoleApp33
{
class Program
{
//----------ZADANIE PIERWSZE--------------
static void przepisz(Stack<int> s, Queue<int> k)
{
Stack<int> s2 = new Stack<int>();
int x;
while (s.TryPop(out x))
{
k.Enqueue(x);
if (x % 2 == 0) s2.Push(x);
}
while (s2.TryPop(out x))
{
s.Push(x);
}
}
static void Parzystosc()
{
int x;
Queue<int> k = new Queue<int>();
Stack<int> s = new Stack<int>();
for (int i = 0; i < 10; i++)
{
s.Push(i);
}
przepisz(s, k);
Console.WriteLine("Zadnie pierwsze");
Console.WriteLine("Queue: ");
while (k.TryDequeue(out x))
{
Console.Write(x + " ");
}
Console.WriteLine();
Console.WriteLine("Parzyste: ");
while (s.TryPop(out x))
{
Console.Write(x + " ");
}
}
//----------KONIEC---------------
//--------ZADANIE DRUGIE----------
static void Slownik()
{
Dictionary<string, string> DictionaryUsers = new Dictionary<string, string>();
SortedDictionary<string, string> SortedDictionaryUsers = new SortedDictionary<string, string>();
SortedList<string, string> SortedListUsers = new SortedList<string, string>();
Random rand = new Random();
string login = "";
string haslo = "";
int losuj;
List<string> logins = new List<string>();
string[] pass = new string[10000];
}
//-------------KONIEC-------------------
//-----------ZADANIE TRZECIE------------
static void Przenoszenie()
{ string x;
int y;
Queue<int> kolejka = new Queue<int>();
for (int i = 0; i < 10; i++)
{
kolejka.Enqueue(i);
}
Stack<string> stos = CopyFrom(kolejka);
Console.WriteLine("nZadanie trzecie");
Console.WriteLine("Queue: ");
while (kolejka.TryDequeue(out y))
{
Console.Write(y + " ");
}
Console.Write("nStack: n");
while (stos.TryPop(out x))
{
Console.Write(x + " ");
}
}
static Stack<string> CopyFrom(Queue<int> kolejka)
{
Stack<string> stos = new Stack<string>();
Stack<int> stos2 = new Stack<int>();
Queue<int> kolejka2 = new Queue<int>();
int x;
Console.WriteLine();
while (kolejka.TryDequeue(out x))
{
stos2.Push(x);
kolejka2.Enqueue(x);
}
while (stos2.TryPop(out x))
{
stos.Push(x.ToString());
}
while (kolejka2.TryDequeue(out x))
{
kolejka.Enqueue(x);
}
return stos;
}
//--------------KONIEC--------------
static void Main(string[] args)
{
Parzystosc();
Slownik();
Przenoszenie();
Console.ReadKey();
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}