Trying to display a 2D array of 4 rows with 10 columns?

My function is supposed to display 4 rows and 10 columns under the words "Lab# Computer".
It displays the words Lab and Computer but the rows/columns are not displayed properly. My entire code is much larger, but I'm just focusing on the showStatus function right now.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 void LoginSystem::showStatus()
{
    using namespace std;
    int cols;
    int rows;
     int i,j;
     cout<<"\nSTATUS\n";
     cout<<"Lab#        Computers\n";     
     for(i=0;i<rows;i++)
     {
        cout<<(i+1)<<"\t";
        for(j=0;j<cols;j++)
        {
            if(labs[i][j]=="empty")
               cout<<(j+1)<<": empty  " ;
            else
               cout<<labs[i][j]<<"  ";
        }
        cout<<"\n";
     }
}
Where do you initialize 'rows' and 'cols'?
Topic archived. No new replies allowed.