By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

For loop help

P: 1
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.
Dec 20 '06 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. for(int i = row + 1,  k = col + 1 ; (i > -1) && (k < 8); i--, k++)
  3.  
use the && for boolean part.
Dec 20 '06 #2

10K+
P: 13,264
Is the loop doing what you wanted it to do then?
Dec 21 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.