cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Multiple For Loop
Multiple For Loop
Jul 28, 2011 at 7:09pm
Jul 28, 2011 at 7:09pm UTC
kzira
(2)
Hi i'm having problem in make a multiple For loop
I wrote this so I can initialize a matrix but for some reason my loop doesn't execute the second loop.
for (int a=0; a==5; a++){ for (int b=0; b==5; b++){ y[a][b]=0; }; };
Jul 28, 2011 at 7:20pm
Jul 28, 2011 at 7:20pm UTC
gmorris7897
(9)
When you initialize the variable at 0, the first thing it's checking is if it is equal to 5. Since you initialize it at 0, it'll never check true to 5, so it'll never check out as true.
Try
for
(
int
a = 0; a <= 5; a++)
And repeat for b.
Jul 28, 2011 at 8:48pm
Jul 28, 2011 at 8:48pm UTC
kzira
(2)
thanks, it worked.
Topic archived. No new replies allowed.