title: C++ stacks and 2D array
body: <p>I have been working on a Project that is suppose to simulate link list by using 2D array for stacks. I have the code but I can not figure out how to make the Random numbers work. I have looked online but online doesn't explain how to make the random function work with the simulation. Here is my code below:</p>
  
  <pre><code>`#include &lt;iostream&gt;
  
  #include &lt;stdlib.h&gt;
  using namespace std;
  
  int myTop = -1;
  int index = -1;
  int next = -1;
  int tt[25][2]; 
  void construct()
  {
      tt[25][2];
  }
  
  void empty()
  {
      if (myTop == -1)
          cout &lt;&lt; "Empty Stack";
      else
          cout &lt;&lt; "Full Stack";
  }
  
  void push(int x)
  {
      if (myTop &lt; 24)
      {   
          myTop++;
          tt[myTop] = x;  
      }
      else
          cout &lt;&lt; "The stack is full.";       
  }
  
  void top()
  {
      if (myTop != -1)
          cout &lt;&lt; "Top Value is: " &lt;&lt; tt[myTop];
      else
          cout &lt;&lt; "Empty Stack";
  
  }
  
  int pop()
  {
      int x;
           if(myTop&lt;=0)
           {
                  cout&lt;&lt;"stack is empty"&lt;&lt;endl;
                  return 0;
           }
           else
           {
                  x=tt[myTop];
                  myTop--;
            }
            return(x);
  
  }
  
  void display()
  {
      for (int row=0; row&lt;25; row++)
      {
          for (int column=0; column&lt;3; column++)
          {
              cout &lt;&lt; tt[row][column] &lt;&lt; "\t";
              if (column == 2)
                  cout &lt;&lt; endl;
          }
      }
      cout &lt;&lt; endl;
  }
  
  int main()
  {
      push(rand() % 25);
      display();
      push(rand() % 25);
      display();
      push(rand() % 25);
      display();
      push(rand() % 25);
      display();
      top();
      pop();
      display();
      top();
      pop();
      display();
      top();
      pop();
      display();
      }
  </code></pre>