0

OK, I've got a [90][10] 2d array. I have a set of pointers that point to the values in the array by column. each column holds different info. It's a payroll file so the zero column of my array corresponds to an employee number. What I want to do is get my pointer array (which has already been initialized to its corresponding employee number in the 2d array) to point to a random employee number. Thanks.

```
while (getline(report, next))
{
int i = 0, j = 0;
for (i = 0; i < R_MAX; i++)
for (j = 0; j < C_MAX; j++)
{
report >> payroll[i][j];
}
report.close();
}
for (i = 0; i < R_MAX; i++)
for (j = 0; j < C_MAX; j++)
{
cout << setw(12) << payroll[i][j];
if((j % 9 == 0)&&(j != 0))
{
cout << endl;
}
}
for (i = 0; i < R_MAX; i++)
for (j = 0; j < C_MAX; j++)
{
if(j == 0)
{
string temp = payroll[i][j];
string *employee_ptr = &temp;
cout << *employee_ptr << endl;
employee_ptr++;
}
if((j % 5 == 0)&&(j != 0))
{
string temp = payroll[i][j];
string *reg_ptr = &temp;
cout << *reg_ptr << endl;
reg_ptr++;
}
if((j % 6 == 0)&&(j != 0))
{
string temp = payroll[i][j];
string *ot_ptr = &temp;
cout << *ot_ptr << endl;
ot_ptr++;
}
if((j % 7 == 0)&&(j != 0))
{
string temp = payroll[i][j];
string *gros_ptr = &temp;
cout << *gros_ptr << endl;
gros_ptr++;
}
if((j % 8 == 0)&&(j != 0))
{
string temp = payroll[i][j];
string *tax_ptr = &temp;
cout << *tax_ptr << endl;
tax_ptr++;
}
if((j % 9 == 0)&&(j != 0))
{
string temp = payroll[i][j];
string *net_ptr = &temp;
cout << *net_ptr << endl;
net_ptr++;
}
}
void randemployee(string *employee_ptr[], const int C_MAX, const int R_MAX)
{
int i , r;
for (i = 0; i < R_MAX; i++)
{
r = i + (rand() % (R_MAX - i)); // Random remaining position.
string temp = *employee_ptr[i]; *employee_ptr[i] = *employee_ptr[r]; *employee_ptr[r] = temp;
}
cout << "shuffled values follow\n";
for (i = 0; i < R_MAX; i++)
{
cout << *employee_ptr[i];
cout << endl;
}
}
```