runtime error while incresing the couter inside a loop

Reply

Join Date: Oct 2007
Posts: 12
Reputation: Srynx is an unknown quantity at this point 
Solved Threads: 0
Srynx Srynx is offline Offline
Newbie Poster

runtime error while incresing the couter inside a loop

 
0
  #1
Nov 9th, 2008
When I include i++; inside this loop I get a runtime error and I have no idea why I get it:
Do you have any idea?

  1. while (i <= 3){
  2.  
  3. if (tauler[PacMan.y][PacMan.x]==0)
  4. xoc = 0;
  5. else if (tauler[PacMan.y][PacMan.x]==1)
  6. xoc = 1;
  7. else if (tauler[PacMan.y][PacMan.x]==2)
  8. xoc = 2;
  9. else
  10. xoc = 3;
  11.  
  12.  
  13. i++;
  14. PacMan.x += dx;
  15. PacMan.y += dy;
  16. }
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: runtime error while incresing the couter inside a loop

 
0
  #2
Nov 9th, 2008
I can't crank an engine. Look at my car mark, please: it's a Crow Victoria.
Do you have any idea?

http://www.daniweb.com/forums/thread78223.html
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,839
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 266
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: runtime error while incresing the couter inside a loop

 
0
  #3
Nov 9th, 2008
What was the value of i before you went into the while loop?
Last edited by ddanbe; Nov 9th, 2008 at 10:20 am.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 12
Reputation: Srynx is an unknown quantity at this point 
Solved Threads: 0
Srynx Srynx is offline Offline
Newbie Poster

Re: runtime error while incresing the couter inside a loop

 
0
  #4
Nov 9th, 2008
Solved,
tauler[PacMan.y + 1 ] is an invalid vaule.
Thanks to everyone who has helped.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC