Multidimensional Arrays : Array Two Dimension « Data Structure « C++






Multidimensional Arrays

Multidimensional Arrays

#include <iostream>
#include <iomanip>
using namespace std;
char representative[2][20] = {"AAAAAAAAAAAA",
                              "BBBBBBBBBBBB"};
int articleCount[2][5] = { { 120, 151, 130, 117, 144},
                            {150, 120, 190, 110, 188}
                          };
int main(){
   for( int i=0; i < 2; i++ ){
      cout <<"\nRepresentative:  " << representative[i];
      cout << "\nNumber of items sold: ";
      for( int j = 0; j < 5; j++ )
         cout << setw(6) << articleCount[i][j];
      cout << endl;
   }
    return 0;
}


           
       








Related examples in the same category

1.Create a two-dimensional array of objects.Create a two-dimensional array of objects.
2.Init two dimension class arrayInit two dimension class array
3.Define and initiate a two-dimensional arrayDefine and initiate a two-dimensional array