You have a consistent problem in all of your for loops.
A for loop has three clauses, as follows, separated by semicolons:
for( initialization ; test condition ; incrementation )
The test condition clauses in all of those for loops are invalid because they are assignment statements, not tests. A test condition will use comparison operators such as ==, >, >=, <, <=, or !=.
The clauses using operators like =- or - are mathematical operators, not comparison operators. The =- operator places the result back in the var to it's left. This is a valid assignment statement. The problem there is that any and all valid assignments ALWAYS evaluate to TRUE when used in a test condition.
The minus operator is just a subtraction operator and the clauses with it don't put the result anywhere. (No = sign and no var to put the result in.) That's why it's invalid.
Now, it is possible to have multiple sub-clauses in each of the three clauses. For example:
int k = 0;
for(int i=2, j=40-x ; i<n && j>=15 ; i++, j--, k = i + j)
//some code here
Note that the three main clauses are separated by semicolons but the sub-clauses are separated by commas in the first and third clause, and all sub-clauses in the (middle) test clause must be combined somehow, usually with && and/or ||.
You would probably benefit greatly from a google search on how to implement a for loop and how to implement a while loop. (I'm anticipating similar issues.) ;-)
Style note: The second, third and fourth for loops should be indented to the same level. All three are inside the first loop, so should be indented once, but are not further nested, so they should be at the same indentation level. If they were further nested multiple levels deep, then they would need the extra indentation.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)