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
#include <iostream>
using namespace std;
int main() {
  int an_array[10];
  int i;
  
  // initialize an_array to hold 0, 1, ..., 9
  // 10 iterations are executed, corresponding to
  // i = 0, 1, ..., 9 
  for (i = 0; i < 10; ++i) {
    an_array[i] = i;
  }
  
  // print the values of the array on a single line
  for (i = 0; i < 10; ++i) {
    cout << an_array[i] << ' ';
  }
  cout << endl;
  
  return 0;
}
Press desired key combination and then press ENTER.