For loop help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoshi
    New Member
    • Dec 2006
    • 1

    #1

    For loop help

    Ok, all I need to know is how to use 2 variables in a for loop. My code is as follows:

    for( int i = row + 1, k = col + 1; i > -1, k < 8; i--, k++)

    Its for an othello program Im wrighting and the error is- ; expected
    Any help would be greatly apprectiated, thanks.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by yoshi
    Ok, all I need to know is how to use 2 variables in a for loop. My code is as follows:

    for( int i = row + 1, k = col + 1; i > -1, k < 8; i--, k++)

    Its for an othello program Im wrighting and the error is- ; expected
    Any help would be greatly apprectiated, thanks.

    Code:
     
    for(int i = row + 1,  k = col + 1 ; (i > -1) && (k < 8); i--, k++)
    use the && for boolean part.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Is the loop doing what you wanted it to do then?

      Comment

      Working...