C++ examples for Data Type:Array
Using a 2D array in a program
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv []) { //ww w . ja v a 2 s. co m int thisArray [3][10]; int i,j ; i = 0; while (i<3) { j = 0; while (j <10) { thisArray [i][j] = (i*j) + (i+j); j ++; } i++; } i = 0; while (i<3) { j = 0; while (j <10) { cout << thisArray [i][j]; if (thisArray [i][j]<10) { cout << " "; } else { cout << " "; } j ++; } cout << endl; i++; } return 0; }