[futurebasic] Re: [FB] i++ vs ++i

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Thu, 28 Feb 2008 00:45:38 +1300
Ken Shmidheiser wrote:

> a[0] = 0;
> for ( i = 1; i <= W; ++i )
> {
>  for ( j = 0; j < n; ++j )
>  {
>   if ( ( c[j] <= i ) && ( a[i] < a[i - c[j]] + v[j] ) )
>   {
>    a[i]    = a[i - c[j]] + v[j];
>    last_added[i] = j;
>   }
>  }
> }


a(0) = 0
i = 1
while ( i <= W )
j = 0
while ( j < n )
long if ( c(j) <= i )
long if ( a(i) < a(i - c(j)) + v(j) )
a(i) = a(i - c(j)) + v(j)
last_added(i) = j
end if
end if
j++
wend
i++
wend


Robert P.