Wulan Kurnias · January 28, 2016 Anyone knows why if (ppg>bestPPG{bestPPG = ppg;bestPlayer= player;}I know those functions are to get the best Player but as I know bestPPG value is 0.0 & all of player gets ppg more than 0. It means those functions will be printing all of player as the best player, right?for example player number 58 has score 0.87so from the function.if 0.87>0{0.87= 0.87;58=58} It will print the best player is 58, same as to another number of player. How can the program could print 66 as the best player? Please help me. Thanks

## Replies

 Linguist Llama · January 29, 2016 ppg, player, bestPPG, and bestPlayer are all variables, meaning they are storage locations for values. You should read "bestPPG = ppg;" as "set bestPPG to ppg", not "bestPPG is equal to ppg" as you appear to be. That's what the logical == operator is for... first last · February 1, 2016 let's say when the program stats it looks like this bestPPG = 0.0player_1 = 60 player_2 = 50 player_3 = 70 now, go through the loop is player_1 > than bestPPG ?is 60 > 0.0 ?yes, so assign the value in player_1 to bestPPG so now bestPPG contains 60 now do the next player is player_2 > than bestPPG ?is 50 > 60 ? no, so leave bestPPG as it is now do the next player is player_3 > than bestPPG ?is 70 > 60 ? yes, so assign the value in player_3 to bestPPG so now bestPPG contains 70 Wulan Kurnias · February 3, 2016 @Linguist Thank you @First last Wow that's clear now. Thanks for the good explanation
• 1

## C

124,582 followers