Cannot enter values for two dimensional array in C++
<p>I'm doing an assignment for a class and it's fairly routine. I've done this before in Java so it's not entirely new to me, however, I'm not entirely sure what's wrong here.</p>

<p>Basically I need to enter information for several row/columns and then print the sum of the column, all of that isn't particularly difficult. However, every time I print my array's contents everything is 1, no matter what.</p>

<p>I'm not sure what's wrong, if someone can tell me why I'd appreciate it.</p>

<p>Oh, forgot to mention, I am using <strong>g++</strong> for compiling.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdio&gt;
using namespace std;

const int ROWS = 4;
const int COLUMNS = 3;

void setupMatrix() {
    // Setup matrix
    double array[ROWS][COLUMNS];

    // Needed? Wouldn't think so.
    // for (int i = 0; i &lt; COLUMNS; i++) {
    //      for (int j = 0; j &lt; ROWS; j++) {
    //              array[i][j] = 0.0;
    //      }
    // }

    // Get array information from user
    for (int i = 0; i &lt; COLUMNS; i++) {
            printf("Row %d\n", (i + 1));
            for (int j = 0; j &lt; ROWS; j++) {
                    printf("Column %d ", (j + 1));
                    cin &gt;&gt; array[i][j];
            }
    }

    // Print array so I can see what's up first
    for (int i = 0; i &lt; COLUMNS; i++) {
            // Row &amp; column separation
            printf("\n");
            for (int j = 0; j &lt; ROWS; j++) {
                    printf("%d ", array[j][i]);
            }
    }

}

int main () {
    setupMatrix();

    return 0;
}
</code></pre>
