So I am new to C++, but I have read on dynamic memory and pointers. I know java well, but java gives you a lot of helpers, C++ not so much D:

Ok so I am using VS 2008, and I am just rather baffled on how to get started.

I have seen tutorials online, but they never compile even some that are just copy and paste, probably #include problems etc.

http://www.codeproject.com/KB/cpp/linked_list.aspx

That was a good read, but I just don't know how the code would actually look like inside visual studio 2008. I would love someone to help me get started.

It could look something like this, simplified for your pleasure( not Compiled)

typedef int DataType; 

class SingleList
{
public:
struct Node{
  DataType value;
  Node * nextNode;
  Node(const DataType& initVal) : value(initVal), nextNode(0){}
};

typedef Node* NodePtr;

private:
  NodePtr front_;
  NodePtr back_;

public:
  SingleList() : front_(0), back_(0) {}
  SingleList(const size_t Size, const DataType& initValue){ _addNewNodes(Size,initValue); }
 

private:
 //helpers
  void _addNewNodes(const size_t Size, const DataType& initValue){ 
   //blank
  }
};

Of course there is more to it but you only ask for help to get started

Thanks for the code, but I still could use some clarification

typedef int DataType; 
 
class SingleList
{
public:
struct Node{
  DataType value;
  Node * nextNode;
  Node(const DataType& initVal) : value(initVal), nextNode(0){}
};
 
typedef Node* NodePtr;
 
private:
  NodePtr front_;
  NodePtr back_;
 
public:
  SingleList() : front_(0), back_(0) {} //I don't get what these 3 lines do
  SingleList(const size_t Size, const DataType& initValue){ _addNewNodes(Size,initValue); }
 
 
private:
 //helpers
  void _addNewNodes(const size_t Size, const DataType& initValue){  //This is for adding a new item to the linkedlist I am assuming, but how exactly would I add a new node like could you give me an example?
   //blank
  }
};

I added some comments if someone could help me out :D

>> SingleList() : front_(0), back_(0) {} //I don't get what these 3 lines do

That is called the initialize list, you can assume its the same as this for now:

SingleList(){
  front_ = 0;
  back_ = 0;
}

>>void _addNewNodes(const size_t Size, const DataType& initValue){ //This is for adding a new item to the linkedlist I am assuming, but how exactly would I add a new node like could you give me an example? //blank }

How about you start it ovoid _addNewNodes(const size_t Size, const DataType& initValue){ //This is for adding a new item to the linkedlist I am assuming, but how exactly would I add a new node like could you give me an example? //blank }


Forget about that, try to make one like this first :

void addNewNode(const DataType& initValue){
  //if head is null then add new Node to head
  // and make head->next null;
  
  //else loop until you find that node->next is null.
  //when found add new node and return ;
}
This article has been dead for over six months. Start a new discussion instead.