Driver code
int main ( ) { float val [ ] = { 14 , 27 , 44 , 19 } ; float wt [ ] = { 6 , 7 , 9 , 8 } ; int n = sizeof ( val ) / sizeof ( val [ 0 ] ) ; int W = 50 ; cout << knapSack ( W , wt , val , n ) ; return 0 ; }