Linked Lists

This is a discussion on Linked Lists within the Networking/Device Communication forums, part of the General Programming Boards category; I have a working class for asynchronous sockets. To handle users, I was thinking of making linked lists to go ...

  1. #1
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640

    Linked Lists

    I have a working class for asynchronous sockets. To handle users, I was thinking of making linked lists to go through connected users, instead of an array of users. I wrote an RPN calculator before using linked lists, but I'm still a little confused as to how to make this work. Do I just give each class unit an id value?
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    25
    Why not use the vector std class? And whatīs a RPN calculator?

  3. #3
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    whatīs a RPN calculator?
    Reverse Polish Notation. e.g. instead of 8+8, its 8 8 +

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    38
    RPN calculators:

    www.hpcalc.org

  5. #5
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    Originally posted by pheer
    Why not use the vector std class? And whatīs a RPN calculator?
    never used it, what is it?
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  6. #6
    Registered User
    Join Date
    Sep 2003
    Posts
    25
    Well, itīs an vector class
    Itīs kind of like a linked list, but easier to use, has more functions and is more failsafe since itīs a standard class coming with all iso compilers.

    Hereīs an example:

    Code:
    #include <iostream>
    #include <vector>
    
    using namespace std;
    
    void main()
    {
    	vector<int> myvector;
    	int a = 5;
    
    	// Add two numbers to myvector
    	myvector.push_back( a );
    	myvector.push_back( a+1 );
    
    	// Print all item in myvector
    	for (int i=0; i < myvector.size(); i++)
    		cout << myvector[i] << endl;
    
    	// Delete the first item in myvector
    	myvector.erase( &myvector.at(0) );
    
    	// Delete all items
    	myvector.clear();
    }
    http://www.cppreference.com/cppvector.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Singly Linked Lists: Clarification Needed
    By jedispy in forum C++ Programming
    Replies: 4
    Last Post: 12-14-2006, 05:30 PM
  2. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 05:32 PM
  3. Map file formats and linked lists
    By Spitball in forum Game Programming
    Replies: 2
    Last Post: 03-04-2004, 11:32 PM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 09:57 PM
  5. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 07:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21