Hello. Kind of new to gamedev.net and to programming in general. Hopefully this is the right place to post.
I finished this code below and got it to work. The first nested for loop outputs + signs on each line. 1 on the first line, all the way to 10 on the 10th line.
The second nested for loop does the same just reverse.
My question is, why doesn't the second nested for loop terminate when j is no longer >= i?
#include <iostream>
using namespace std;
int main()
{
for (int i = 1; i <= 10; ++i)
{
for (int j = 1; j <= i; ++j)
{
cout << "+";
}
cout << endl;
}
cout << endl;
for (int i = 1; i <= 10; ++i)
{
for (int j = 10; j >= i; --j)
{
cout << "+";
}
cout << endl;
}
}