Click here to Skip to main content
14,826,253 members
Home / Discussions / C#
   

C#

 
AnswerRe: Calling methods of Unmanaged dll Pin
Raheem MA5-Aug-08 20:02
MemberRaheem MA5-Aug-08 20:02 
QuestionType.missing vs null Pin
Mogaambo5-Aug-08 19:29
MemberMogaambo5-Aug-08 19:29 
AnswerRe: Type.missing vs null Pin
MarkB7775-Aug-08 20:55
MemberMarkB7775-Aug-08 20:55 
QuestionMESSEGE BOX HELP Pin
lankaudaranga5-Aug-08 19:20
Memberlankaudaranga5-Aug-08 19:20 
AnswerRe: MESSEGE BOX HELP Pin
Paul Conrad5-Aug-08 19:22
professionalPaul Conrad5-Aug-08 19:22 
QuestionOne problem Pin
Preeti19795-Aug-08 18:53
MemberPreeti19795-Aug-08 18:53 
AnswerRe: One problem Pin
Paul Conrad5-Aug-08 19:24
professionalPaul Conrad5-Aug-08 19:24 
QuestionQueuebuilding. [modified] Pin
Angelinna5-Aug-08 18:28
MemberAngelinna5-Aug-08 18:28 
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;
public queuenode next;
}

class queue
{
queuenode front; // referencing to front of queue
queuenode rear; // referencing to rear of queue

// initialising a queue
public void queue_init()
{
front = null;
rear = null;
}

// testing for an empty queue
public Boolean empty()
{
return(front == null);
}

// adding a value to the rear of a queue
public void enqueue(int val)
{
queuenode temp;

temp = new queuenode();
temp.nodedata = val;
temp.next = null;
if (empty())
front = temp;
else rear.next = temp;
rear = temp;
}

// building a string that represents queue contents
public string printQueue()
{
string nextItem;
string queueContents;
queuenode queueRef;

queueContents = " ";
queueRef = front;
while (queueRef != null)
{
nextItem = queueRef.nodedata.ToString();
queueContents = queueContents + nextItem + " ";
queueRef = queueRef.next;
}
return queueContents;
}

// adding a code to dequeue an item from the front of a queue
public void dequeue()
{
//front = front.next;
if (empty())
front = null;
else
front = front.next;

}
1. // Trying to add code to remove every second item from a queue
public void even_items()
{
delete(front);

front = front.next;


}


}
2. // Trying to add code to reverse a queue
public void reverseQueue()
{
}



}
}

modified on Wednesday, August 6, 2008 5:20 AM

AnswerRe: Queuebuilding. Pin
J a a n s6-Aug-08 0:05
professionalJ a a n s6-Aug-08 0:05 
GeneralRe: Queuebuilding. Pin
Angelinna6-Aug-08 2:18
MemberAngelinna6-Aug-08 2:18 
GeneralRe: Queuebuilding. Pin
J a a n s6-Aug-08 3:26
professionalJ a a n s6-Aug-08 3:26 
QuestionRe: Queuebuilding. [modified] Pin
Angelinna6-Aug-08 9:38
MemberAngelinna6-Aug-08 9:38 
QuestionEdit a resource file runtime Pin
vaibhav.jape@gmail.com5-Aug-08 18:12
Membervaibhav.jape@gmail.com5-Aug-08 18:12 
QuestionLogOff computer by code Pin
H.R5-Aug-08 17:52
MemberH.R5-Aug-08 17:52 
AnswerRe: LogOff computer by code Pin
John_Adams5-Aug-08 18:23
MemberJohn_Adams5-Aug-08 18:23 
Questionlogin eror The 'Microsoft.Jet.OLEDB.4.0Data Source=C:\Documents and Settings\13861957\Desktop\logindb2.mdb' provider is not registered on the local machine. Pin
eQyZ5-Aug-08 17:48
MembereQyZ5-Aug-08 17:48 
AnswerRe: login eror The 'Microsoft.Jet.OLEDB.4.0Data Source=C:\Documents and Settings\13861957\Desktop\logindb2.mdb' provider is not registered on the local machine. Pin
PIEBALDconsult5-Aug-08 18:08
professionalPIEBALDconsult5-Aug-08 18:08 
Questionlogin box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
Arif Liminto5-Aug-08 17:46
professionalArif Liminto5-Aug-08 17:46 
AnswerRe: login box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
PIEBALDconsult5-Aug-08 18:05
professionalPIEBALDconsult5-Aug-08 18:05 
AnswerRe: login box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
Arif Liminto6-Aug-08 2:52
professionalArif Liminto6-Aug-08 2:52 
QuestionError accessing dll through the process, running under "Network Service" user . Pin
fulbright5-Aug-08 17:42
Memberfulbright5-Aug-08 17:42 
Questionfind control Pin
Shine Tyler5-Aug-08 17:39
MemberShine Tyler5-Aug-08 17:39 
AnswerRe: find control Pin
Paul Conrad5-Aug-08 19:26
professionalPaul Conrad5-Aug-08 19:26 
QuestionWebRequest.Proxy Pin
George_George5-Aug-08 16:10
MemberGeorge_George5-Aug-08 16:10 
AnswerRe: WebRequest.Proxy Pin
jkersch5-Aug-08 21:38
Memberjkersch5-Aug-08 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.