using System; using System.Collections.Generic; using System.Diagnostics; namespace ConsoleApp33 { class Program { //----------ZADANIE PIERWSZE-------------- static void przepisz(Stack s, Queue k) { Stack s2 = new Stack(); 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 k = new Queue(); Stack s = new Stack(); 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 DictionaryUsers = new Dictionary(); SortedDictionary SortedDictionaryUsers = new SortedDictionary(); SortedList SortedListUsers = new SortedList(); Random rand = new Random(); string login = ""; string haslo = ""; int losuj; List logins = new List(); string[] pass = new string[10000]; } //-------------KONIEC------------------- //-----------ZADANIE TRZECIE------------ static void Przenoszenie() { string x; int y; Queue kolejka = new Queue(); for (int i = 0; i < 10; i++) { kolejka.Enqueue(i); } Stack 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 CopyFrom(Queue kolejka) { Stack stos = new Stack(); Stack stos2 = new Stack(); Queue kolejka2 = new Queue(); 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(); } } }