title: C++ problem "Find the last position of -1(negative one)"
body: <p>Position of &quot;-1&quot;.</p>
  <p>In the given NxM matrix find the LAST position of the minus one(-1).
  If it will be no &quot;-1&quot; value in the given matrix just output &quot;-1 -1&quot;.</p>
  <p>Input
  First line N and M (1&lt;=N,M&lt;=100).
  Then NxM table is given(all number are integers)</p>
  <p>Output
  First number have to be the row number,and then column number of last &quot;-1&quot; element.</p>
  <p>Here is my solution. But I have wrong answer.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;climits&gt;
  using namespace std;
  
  int main () {
      int row, col;
      double x = 0, y = 0;
      cin &gt;&gt; row &gt;&gt; col;
      int matrix[row][col];
      for (int i = 0; i &lt; row; i++) {
          for (int j = 0; j &lt; col; j++) {
              cin &gt;&gt; matrix[i][j];
              if (matrix[i][j] &lt; 0) {
                  x = i + 1;
                  y = j + 1;
              }
  
          }
      }
      if (x == 0 &amp;&amp; y == 0)
          x = -1, y = -1;
      cout &lt;&lt; x &lt;&lt; &quot; &quot; &lt;&lt;y;
  }
  </code></pre>