Do you know how for loops work?
1 2 3 4
|
for( initialize; loop_condition; increment )
{
// ...
}
|
The "initialize" section is run once, when the loop starts.
The "loop_condition" section is checked every time the loop runs. If it is false, the loop exits.
The "increment" section is run every time the loop finishes one iteration.
So take a look at your outer loop:
|
for (int outer = 2; outer < 11; outer += 2)
|
Here, your "initialize" section is
int outer = 2;
This means you create a variable named outer, and it has a starting value of 2.
Your "loop_condition" is
outer < 11
. This means that the loop will continue to run as long as outer is less than 11. Once outer is greater than or equal to 11, the loop will exit.
Your "increment" section is
outer += 2
, which means that every time the loop completes one iteration, your outer variable is increased by 2.
So now if you have new variables for a new increment and endvalue, and you want to change this loop to use them -- it should be pretty straightforward where you need to put them.