Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Warshall's
#1
is this the right code? The matrix I get by hand is slightly different than the matrix i get with this code:

Code:
    for (int k = 0; k < size; k++)
        for (int i = 0; i < size; i++)
            for (int j = 0; j < size; j++)
                graph[i][j] = graph[i][j] || graph[i][k] && graph[k][j];

Is there supposed to be parenthesis around one of the boolean operations?
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.
Reply
#2
Well, I don't know the formula. All I just can say is that || and && have the same preference and are read from left to right.

Plus, || and && are comparators and you should be using bitwise operators, which happen to be | and &.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)