title: How To Check empty Lines?
body: <p>my input.txt file: </p>
  
  <pre><code>4
  
  4
  
  5 0 1 2
  1 4 0 0
  1 1 5 4
  0 6 3 2
  
  0 4 1 2
  1 7 5 0
  2 3 5 6
  0 6 2 2
  
  1:0 4 2 0
  </code></pre>
  
  <p>my program for now:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sstream&gt;
  using namespace std;
  
  int main()
  {
  ifstream File("input.txt");
  string line;
  string num;
  string array[50];
  string comma;
  int i=0;
      while (getline(File,line)) {
  
          comma="";
          istringstream s(line);
  
          if (line.empty()){
  
              comma=",";
              s &gt;&gt; num ;
              array[i] =  comma;
          }
  
          else {
              s &gt;&gt; num ;
              array[i] =  num;
          }
          i++;
  
      }        
  return 0;
  }
  </code></pre>
  
  <p>well, my program is not giving me what I want! when I print the array[i] its giving me only the numbers in the first Column! like this :</p>
  
  <pre><code>4
  ,
  4
  ,
  5
  3
  1
  7
  ,
  0
  1
  2
  6
  ,
  1:0
  </code></pre>
  
  <p>what i want to do is to put a comma where ever there is an empty line , so I can <strong>distinguish between these numbers</strong> and store them inside an <strong>intger</strong> array to do <strong>mathematical operations between them</strong>.</p>
  
  <p>to explain my input.txt file:</p>
  
  <blockquote>
    <p>numbers and matrix size inside input file can be changed by me.</p>
  </blockquote>
  
  <pre><code>4 &lt;= #number of items 
  
  4 &lt;= #types of items
  
  5 0 1 2 &lt;= matrix #1
  1 4 0 0
  1 1 5 4
  0 6 3 2
  
  0 4 1 2 &lt;= matrix #2
  1 7 5 0
  2 3 5 6
  0 6 2 2
  
  1:0 4 2 0 &lt;= Available numbers for item #1 
  </code></pre>
  
  <p>and I want to :</p>
  
  <ol>
  <li><p>store number of items inside a variable.</p></li>
  <li><p>store types of items inside a variable.</p></li>
  <li><p>store <strong>matrix #1</strong> and <strong>matrix #2</strong> inside a an <strong>2 arrays</strong> and do <strong>Subtraction</strong> between <strong>matrix #1 and matrix #2.</strong></p></li>
  </ol>
  
  <p>Can this be done ? or is there any easier method to distinguish between these numbers and store them inside variables and an inter array ?</p>