Esempio n. 1
0
        public static MyQueue Task(MyQueue mq)
        {
            int     x     = mq.Out();
            MyQueue queue = new MyQueue();

            queue.InQueue(x);
            while (mq.head != null)
            {
                var tmp = mq.Out();
                if (tmp != x)
                {
                    x = tmp;
                    queue.InQueue(x);
                }
            }
            return(queue);
        }
Esempio n. 2
0
File: TF.cs Progetto: LatyninG/Atta2
        public MyQueue Read()
        {
            FileStream   fs = new FileStream(Path, FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs);
            MyQueue      mq = new MyQueue();

            while (!sr.EndOfStream)
            {
                string p = sr.ReadLine();
                mq.InQueue(Convert.ToInt32(p));
            }
            sr.Close();
            fs.Close();
            return(mq);
        }