Can someone explain to me in great detail what is goin on in this loop.It's pretty simple but i can't seem to fully understand the bottom half(the second loop).
Basiclly this function will display this pattern (which is used when playing NIM) :-
|
| |
| | |
| | | |
| | | | |
Also the variable "a" just point at an array , which is :-
int row[6] = {0, 1, 2, 3, 4, 5};
Example -- when i call this function , i would go like this
display (row)
void display(int* a)
{
cout << "|-----------------------------|\n";
for(int i = 0; i < 6; i++)
{
if(i==1) cout << " ";
if(i==2) cout << " ";
if(i==3) cout << " ";
if(i==4) cout << " ";
if(i==5) cout << " ";
for(int j =1; j <= *a; j++)
cout << " |";
a++;
cout << "\n\n";
}
cout << "\n|-----------------------------|\n";
}
So if someone understands this please reply
thanks in advance
Basiclly this function will display this pattern (which is used when playing NIM) :-
|
| |
| | |
| | | |
| | | | |
Also the variable "a" just point at an array , which is :-
int row[6] = {0, 1, 2, 3, 4, 5};
Example -- when i call this function , i would go like this
display (row)
void display(int* a)
{
cout << "|-----------------------------|\n";
for(int i = 0; i < 6; i++)
{
if(i==1) cout << " ";
if(i==2) cout << " ";
if(i==3) cout << " ";
if(i==4) cout << " ";
if(i==5) cout << " ";
for(int j =1; j <= *a; j++)
cout << " |";
a++;
cout << "\n\n";
}
cout << "\n|-----------------------------|\n";
}
So if someone understands this please reply
thanks in advance