Using subscript notation in linked list in C++

Hi,I’m writing a program to illustrate the work of psedourandom sequence generator-LFSR(Linear Feedback Shift Register).
Input   :  initial state of LFSR,primitive polynomial.
Output : psedourandom sequence(a combination of initial state by mod 2)
Since the length of LFSR and the polynomial are given by the user when he runs program, i decided to use linked list to contain all the state of LFSR. But then I stuck in how to use subscript notation. Say,for example I have the length of LFSR n=4 and the polynomial f(x)=x^4+x+1.It means in the linked list I have a[i+4]=a[i]+a[i+1] (a[0]-a[3] are given by the user)(assume it like an unlimited array ),but I don’t know how to handle it.Please I need your help!!!
Here’s part of my code:
     #include <iostream.h>
     // object to add to list
       class Data
         Data() { itsValue = 0;}
         Data(int Position):itsPosition(Position){}
         Data(int data,int Position):itsValue(data),its Position (Position){}
         int GetValue() const { return itsValue; }
         int Get Position ()const{return its Position;}
         int itsValue;
         int its Position;

      // manages list, orders by its Position.
       class Node
         Node (Data*);
         void SetNext(Node * node) { itsNext = node; }
         Node * GetNext() const { return itsNext; }
         Data * GetData() const { return itsData; }
         void Insert(Node *);        
         Data *itsData;
         Node * itsNext;

       Node::Node(Data* pData):

         delete itsData;
         itsData = 0;
         delete itsNext;
         itsNext = 0;

       void Node::Insert(Node* newNode)
         if (!itsNext)
            itsNext = newNode;
               itsNext = newNode;

      int main()
         int nbr;
         cout<<"Enter the number of registers: ";
         Node *pNode = 0;
         Data * pData = new Data(0,-1);
         int data;
         Node *pHead = new Node(pData);
         for(int i=0;i<nbr;)
            cout << "Value of register "<<i<<"is: ";
            cin >>data ;
            if (data!=0&&data!=1)
               cout<<"Entry is not correct";
            pData = new Data(data,i);
            pNode = new Node(pData);
         WHAT CAN I DO FURTHER?!!!
         return 0;
Who is Participating?
ZonebitConnect With a Mentor Commented:

Glad to help out.  Your thanks (and your points) are much appreciated.
Scarecrow248Author Commented:
Thanks a lot for your help. Your tutorials have helped me alot
All Courses

From novice to tech pro — start learning today.