Click here to Skip to main content
15,920,383 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why is the constructor protected ? Pin
John M. Drescher11-Jul-03 7:55
John M. Drescher11-Jul-03 7:55 
GeneralRe: Why is the constructor protected ? Pin
Anthony_Yio15-Jul-03 1:27
Anthony_Yio15-Jul-03 1:27 
QuestionI don’t’ know how I can find the character set like it? Pin
Alice8011-Jul-03 7:20
Alice8011-Jul-03 7:20 
AnswerRe: I don’t’ know how I can find the character set like it? Pin
Mike Dimmick11-Jul-03 10:02
Mike Dimmick11-Jul-03 10:02 
GeneralRe: I don’t’ know how I can find the character set like it? Pin
Alice8012-Jul-03 1:54
Alice8012-Jul-03 1:54 
GeneralRe: I don’t’ know how I can find the character set like it? Pin
Mike Dimmick12-Jul-03 2:12
Mike Dimmick12-Jul-03 2:12 
AnswerRe: I don’t’ know how I can find the character set like it? Pin
Anthony_Yio15-Jul-03 1:33
Anthony_Yio15-Jul-03 1:33 
GeneralLinked list Pin
DaveE9th11-Jul-03 6:57
DaveE9th11-Jul-03 6:57 
I'm trying to learn how to implement a linked list. I'm having a fun time trying to get the following code to work. I didn't create a seperate header file for the top part (where the node class is defined) because I wanted to keep it simple at this point. I'm not sure where to add the main funtion or what header needs to be specified if any. I did a google search for the pop and push functions but didn't find a header. Also, where do I enter the information I want to add to my linked list database? I was hoping someone would help me out here, or at least point me in the right direction. Thanks much, Dave.
---------------------------------------------------------
//node class defined

class node {
private:
friend class llist; // We will have an llist class to manipulate
// nodes, and we want it to access node.
int information; // I'm assuming that this is a linked list
// of integers.
node *next; // Pointer to the next node.
node *previous; // Pointer to the previous node.
}

//----------------------------------------------------

//Ceate the llist class

class llist {
private:
node base; // We need a base node, from which other nodes will spring.
node *current; // A pointer to the current node.
public:
void push(int item);
int pop();
}


void llist::push(int item)
{
node *temp=current; // Temporary node
current->next=new node; // Create new node
current=current->next; // Assign current to new top node
current->information=item; // Assign the data
current->previous=temp; // Set previous pointer
}

int pop()
{
int temp;

temp=current->information;
if (current->previous == NULL) // Following a NULL pointer will lead to nothing but folly
return temp;
current=current->previous;
delete current->next;
return temp;
}


OMG | :OMG:
GeneralRe: Linked list Pin
David Crow11-Jul-03 7:06
David Crow11-Jul-03 7:06 
GeneralRe: Linked list Pin
DaveE9th12-Jul-03 2:24
DaveE9th12-Jul-03 2:24 
GeneralRe: Linked list Pin
John M. Drescher11-Jul-03 7:20
John M. Drescher11-Jul-03 7:20 
GeneralRe: Linked list Pin
DaveE9th11-Jul-03 8:24
DaveE9th11-Jul-03 8:24 
GeneralRe: Linked list Pin
DaveE9th11-Jul-03 20:34
DaveE9th11-Jul-03 20:34 
GeneralProperty Pages question Pin
skinnyreptile11-Jul-03 6:34
skinnyreptile11-Jul-03 6:34 
GeneralRe: Property Pages question Pin
David Crow11-Jul-03 7:14
David Crow11-Jul-03 7:14 
GeneralOpen modeless Dialog from a DLL Pin
Mathias S.11-Jul-03 6:09
Mathias S.11-Jul-03 6:09 
GeneralMaximum Window size Pin
pankajdaga11-Jul-03 6:03
pankajdaga11-Jul-03 6:03 
GeneralRe: Maximum Window size Pin
KaЯl11-Jul-03 12:30
KaЯl11-Jul-03 12:30 
GeneralAccessing USB port Pin
Jonathan Gilligan11-Jul-03 6:02
Jonathan Gilligan11-Jul-03 6:02 
GeneralRe: Accessing USB port Pin
valikac11-Jul-03 6:27
valikac11-Jul-03 6:27 
GeneralRe: Accessing USB port Pin
Jonathan Gilligan11-Jul-03 6:40
Jonathan Gilligan11-Jul-03 6:40 
GeneralAdding toolbar to Visual C++ IDE Pin
Anonymous11-Jul-03 6:02
Anonymous11-Jul-03 6:02 
Generalreverse inet_ntoa Pin
RobJones11-Jul-03 5:25
RobJones11-Jul-03 5:25 
GeneralRe: reverse inet_ntoa Pin
Ryan Binns11-Jul-03 5:30
Ryan Binns11-Jul-03 5:30 
GeneralRe: reverse inet_ntoa Pin
RobJones11-Jul-03 5:37
RobJones11-Jul-03 5:37 

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.