Here is a decent tutorial I found. I didn't read it all though.. just skimmed through it.
The basic structure of a linked list is this.
int info; //Could be any data type really, this is the field for the actual data.
Node *next; //This is a pointer the the next node in the list.
When I use linked lists I find it useful for keeping track of the first element in the list, called the head. This allows us to go back to the first element in the list, no matter what our current position is.
For creating a linked list with a head node and a current node you would do..
head = NULL;
current = NULL;
head = new Node;
current = head;
Create the head node and then set current equal to the head.
After you set the current = head you will not need to do anything to the head node, unless you want to change it or its next pointer.
This is how you would add data to the current node.
cin >> current -> info; // read in data and store it into info.
current -> next = NULL;
current -> next = new Node; //create the next element in the list
current = current -> next; // make the current element become the next.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.