hi, can anyone help me? i can't seem to convert my loop.
this is my for loop
int i = 1;
const char square = '&';
for (int i = 1; i <= n; i++)
{
cout << square;
for (int i = 1; i < n; i++)
cout << '\t' << square;
cout << endl;
}
this is my while loop
int i = 1;
const char square = '&';
while (i <= n)
{
cout << square;
while (i < n)
{
cout << '\t' << square;
i++;
}
i++;
}
is there a problem with the conversion?
Yes you are incrementing two times i ... why you just don't use two differente variables names like i and j it's simplier
but even if i change it to 2 different variables, i don't get the same result as my for loop