Code: Select all
#include <iostream>
class T {
struct node { // well this is obious
unsigned long ID; // uniquesnode id
node *next;
node *prew;
};
node *root;
unsigned long ncount; // number of nodes
public:
T(unsigned long i) { // initializing and constructing
unsigned long id = 0;
ncount = i;
root = new node;
node *temp = root;
for(int n = 1; n < ncount; n++, id++) {
temp->ID = id;
temp->next = new node;
temp->next->prew = temp;
temp = temp->next;
}
temp->next = root; // making it circular, well i though it would
root->prew = temp;
}
void Print_List() { // a little print func that should print the whole list
while(root->ID < root->next->ID) {
std::cout << root->ID << std::endl;
root = root->next;
}
}
};