Explore Connect Documentation
Snippets
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
#include <iostream>
using namespace std;
int main() {
  int i;
  int j;
  const int N = 10;
  int a_table[N][N];  // NxN 2D array
  
  // initialize table to hold the values 0, 1, ..., 99
  for (i = 0; i < N; ++i) {
    for (j = 0; j < N; ++j) {
      a_table[i][j] = i * N + j;
    }
  }
  
  // print the table
  for (i = 0; i < N; ++i) {
    for (j = 0; j < N; ++j) {
      cout << a_table[i][j] << ' ';
    }
    cout << endl;
  }
  
  return 0;
}
Press desired key combination and then press ENTER.