Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Queuebuilding. [modified]

Queuebuilding. [modified]

Scheduled Pinned Locked Moved C#
data-structuresgraphicshelpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Angelinna
    wrote on last edited by
    #1

    Seeking help with the last blocks of codes numbered 1 and 2 on the forme1.cs and queue.cs shown below.? It all working well. Stack on the last blocks. FORM 1.CS using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Queuebuilder { public partial class Form1 : Form { public Form1() { myQueue = new queue(); myQueue.queue_init(); InitializeComponent(); } queue myQueue; // making a queue empty private void initbutton_Click(object sender, EventArgs e) { myQueue.queue_init(); displayQueue(); } // enqueueing an item private void enqueuebutton_Click(object sender, EventArgs e) { int val; try { val = Convert.ToInt32(inputBox.Text); inputBox.Clear(); } catch { MessageBox.Show("Please enter an integer."); inputBox.Focus(); return; } myQueue.enqueue(val); displayQueue(); inputBox.Focus(); } // private void dequeuebutton_Click(object sender, EventArgs e) { myQueue.dequeue(); displayQueue(); //displayBox.Focus(); } // displaying queue contents private void displayQueue() { string displayString; displayString = myQueue.printQueue(); displayBox.Clear(); displayBox.AppendText(displayString); displayBox.AppendText("\n"); } 1. // Trying to remove every second item private void evenitemsbutton_Click(object sender, EventArgs e) { myQueue.dequeue(); displayQueue(); } 2. // Trying to reverse the queue private void reversebutton_Click(object sender, EventArgs e) { } } } ------------------------------------------------------------ QUEUE.CS using System; using System.Collections.Generic; using System.Text; namespace Queuebuilder { class queuenode { public int nodedata; publ

    J 1 Reply Last reply
    0
    • A Angelinna

      Seeking help with the last blocks of codes numbered 1 and 2 on the forme1.cs and queue.cs shown below.? It all working well. Stack on the last blocks. FORM 1.CS using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Queuebuilder { public partial class Form1 : Form { public Form1() { myQueue = new queue(); myQueue.queue_init(); InitializeComponent(); } queue myQueue; // making a queue empty private void initbutton_Click(object sender, EventArgs e) { myQueue.queue_init(); displayQueue(); } // enqueueing an item private void enqueuebutton_Click(object sender, EventArgs e) { int val; try { val = Convert.ToInt32(inputBox.Text); inputBox.Clear(); } catch { MessageBox.Show("Please enter an integer."); inputBox.Focus(); return; } myQueue.enqueue(val); displayQueue(); inputBox.Focus(); } // private void dequeuebutton_Click(object sender, EventArgs e) { myQueue.dequeue(); displayQueue(); //displayBox.Focus(); } // displaying queue contents private void displayQueue() { string displayString; displayString = myQueue.printQueue(); displayBox.Clear(); displayBox.AppendText(displayString); displayBox.AppendText("\n"); } 1. // Trying to remove every second item private void evenitemsbutton_Click(object sender, EventArgs e) { myQueue.dequeue(); displayQueue(); } 2. // Trying to reverse the queue private void reversebutton_Click(object sender, EventArgs e) { } } } ------------------------------------------------------------ QUEUE.CS using System; using System.Collections.Generic; using System.Text; namespace Queuebuilder { class queuenode { public int nodedata; publ

      J Offline
      J Offline
      J a a n s
      wrote on last edited by
      #2

      Why cant you go for a Queue[^] class? For reversing you may have to make use of Array.Reverse method.

      *jaans

      A 1 Reply Last reply
      0
      • J J a a n s

        Why cant you go for a Queue[^] class? For reversing you may have to make use of Array.Reverse method.

        *jaans

        A Offline
        A Offline
        Angelinna
        wrote on last edited by
        #3

        How do I do that? :((

        J 1 Reply Last reply
        0
        • A Angelinna

          How do I do that? :((

          J Offline
          J Offline
          J a a n s
          wrote on last edited by
          #4

          1. You can use the ToArray method of Query class to get the array of items. 2. Use Array.Reverse method for reversing it. 3. Create a new queue instance with the reversed array. Note: I won't be giving the code as it seems to be a home work

          *jaans

          A 1 Reply Last reply
          0
          • J J a a n s

            1. You can use the ToArray method of Query class to get the array of items. 2. Use Array.Reverse method for reversing it. 3. Create a new queue instance with the reversed array. Note: I won't be giving the code as it seems to be a home work

            *jaans

            A Offline
            A Offline
            Angelinna
            wrote on last edited by
            #5

            It is actually not a homework. It is a code question from past exam papers. I would appreciate so much if you could show the code structures just for the last blocks only as is seen. :(( :confused:

            modified on Thursday, August 7, 2008 3:20 AM

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups