title: Displaying linked list nodes vertically and horizontally in C++
body: <p>before asking the following question, I really did my best for 4 hours to look for an answer but unfortunately I did not found what I am looking for in C++. Hopefully, some of you could help me. The question is very simple. I have a linked list whose nodes take 2 key values for example :</p>
  
  <pre><code>struct myNode{
    int a ;
    int b ;
    myNode *nextNode ;
    myNode *prevNode ;
  } ;
  </code></pre>
  
  <p>I can display all nodes of such a list vertically using  COUT such as (pseudo code) :</p>
  
  <pre><code>while (myList){
    cout &lt;&lt; myList-&gt;a &lt;&lt; " " &lt;&lt; myList-&gt;b &lt;&lt; "\n" ;
    increment myList (myList = myList-&gt;nextNode) ;
  }
  </code></pre>
  
  <p>the result will be :</p>
  
  <pre><code> a1 b1
   a2 b2
   a3 b3
   .
   .
   .
   an bn
  </code></pre>
  
  <p>Instead of displaying this vertically I want to display them horizontally to have a result similar to :</p>
  
  <pre><code>a1 a2 a3 a4 ... an
  b1 b2 b3 b4 ... bn
  </code></pre>
  
  <p>In other words, how can I print in C++ a number of n elements vertically and then move to the right and start printing other n elements vertically (from the first line) parallel to the previous column and so on...</p>
  
  <p>Thank you for your answers.</p>
  
  <p>L.</p>