0

I am trying to use a two dimensional array to make a counter program. Essentially, the first row should give the "header" of the numbered objects for which the criteria are being counted; the other rows should represent the various counting criteria (like a simple tally-chart).

The catch is that I would like to have the number of numbered objects (in this case, "players") determined by user input. It seems simple enough to cin and customize the number of columns and rows. This, I believe, can be accomplished with the following:

int cols; 
int rows;
cout << "How many players?" << ":";
cin >> cols;
cout << "How many criteria ?" << ":";
cin >> rows;
int[rows][cols] myArray;

Is there any way, however, to set the first row of the array based on the number of players? That is, to define a sequence of integers {1,2,...,cols}, up to the specified number of columns? Dually, would it be possible to set all other row entries to zero for a variable number of rows?

I would appreciate any help! Thanks for your time.

cloudchamber
  • 121
  • 2
  • 6

0 Answers0