Need help with recursion and arrays

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2002
Posts: 12,057
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Need help with recursion and arrays

 
0
  #11
Nov 20th, 2004
Ahh! But if you look above that loop, you will realize that the first row and the first column of the matrix are populated each in their own individual loops, therefore taking care of [1][y] and [x][1]
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 11
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Need help with recursion and arrays

 
0
  #12
Nov 20th, 2004
true for distance[][] but not path[][].

Or am I smoking too much crack again?

  1. for (x=startx+1; x<=endx; x++)
  2. {
  3. distance[x][starty] = distance[x-1][starty] + r[x-1][starty];
  4. cout << "We went right to get to (" << x << "," << starty << ") in " << distance[x][starty] << " units" << endl;
  5. }

path[x][starty] is set to, er, well, see, it's like this....
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum


Views: 4574 | Replies: 11
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC