I need help in using 2d arrays in c++. I want to output a table that looks like this
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29 30
except i want to do it using a 2d array and have the user input a value (n) and the table to be nxn.
I literally have no idea where to start on this so any amount of help or suggestions would be greatly appreciated.
#include <iostream>
using namespace std;
int main()
{
int n, i, j;
cin >> n;
int board[n][n], array[n][n];
for(i=0;i<n; i++)
{
for(j=0;j<n;j++)
{
array[n][n]>>board[i][j];
}
}
for(i=0;i<n;i++){
cout<<endl;
for(j=0;j<n;j++){
cout<<" "<<board[i][j];
}
}
system("PAUSE");
return 0;
}
this is my code thus far, pretty much all it does right is output the correct number of columns and rows but not the correct values