Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5428
Number of posts: 16949

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
dequeue function in c++ Posted by danit on 19 Nov 2012 at 2:37 AM
i am writing code for queue which uses linked list data structure for its implementation, in which node class has two data member(for instance node has name and number in its private section) , i am having problem to write function for get() in dequeue(delete node having two data members and move front pointer ahead) as there are two data members,
first i wrote:

int dequeue()
{
int x = front->get() ;
node *p = front ;
front = front->getnext() ;
delete p;
size--;
return x ;
}
then i wrote:
int dequeue()
{
int x = front->getname() ;
node *w =front->getage() ;
node *p = front ;
front = front->getnext() ;
delete p ;
delete w ;
size--;
return x ;
}
both are not working ,i need some advise.
(clarification will be provided if needed)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.