Exemple d’initialisation d’un tableau multidimensionnel: à revoir

Author:


Download


#include 
#include 
using namespace std;
char representative[2][20] = {"abcdefghijklmnop",
                              "qrstuvwxyz"};
int articleCount[2][5] = { { 120, 151, 130, 117, 144},
                            {150, 120, 190, 110, 188}
                          };
int main()
{
   for( int i=0; i < 2; i++ )
   {
      cout <<"Representative:  " << representative[i];
      cout << "Number of items sold: ";
      for( int j = 0; j < 5; j++ )
         cout << setw(6) << articleCount[i][j];
      cout << endl;
   }
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *