public static MyQueue RandomQueue(MyQueue q) // задать рандомную очередь из 20 элементов
        {
            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                int a = rnd.Next(-40, 40);
                q.InQueue(a);
            }
            return(q);
        }
        /// <summary>
        /// Get 2 queues.
        /// </summary>
        /// <param name="queueInt"> Queue of integer number </param>
        /// <param name="queueString"> Queue of string </param>
        private static void TestQueues(MyQueue <int> queueInt, MyQueue <string> queueString)
        {
            queueInt.Enqueue(7);
            queueInt.Enqueue(5);
            queueInt.Enqueue(3);
            Console.WriteLine(queueInt);

            queueString.Enqueue("Hi there again!");
            queueString.Enqueue("Generics are really great!");
            Console.WriteLine(queueString);
        }
 Node find(MyQueue Q, Node a)
 {
     if (a != null)
     {
         if (a.Inf >= 0)
         {
             return(a);
         }
         else
         {
             if (a != Q.Tail)
             {
                 find(Q, a.Next);
             }
         }
     }
     return(a);
 }
Esempio n. 4
0
 private void button_rndQueue_Click(object sender, EventArgs e)
 {
     Q = MyQueue.RandomQueue(Q);
     textBox_Queue.Lines = Q.GetstringQueue(Q);
 }
 public MyQueue Delete(MyQueue Q)
 {
     return(DeleteNegative(Q, Q.Head));
 }
 public void ClearQueue(MyQueue Q)
 {
     Q.Tail = null;
     Q.Head = null;
 }
        public string[] GetstringQueue(MyQueue q) // возвращяет string[] со значениями очереди
        {
            List <string> Lines = new List <string>();

            return(setlines(q.Head, Lines));
        }