Closed danius0001 closed 6 years ago
if (bid > bestPrice) { secondBest = bestPrice; bestPrice = bid; bestSocket = socket; } if (bid < bestPrice && bid > secondBest) { secondBest = bid; }
Gdy bid == aktualny bestPrice -> secondBest nie będzie poprawnie wyliczony. Tak będzie ok: if (bid > bestPrice) { secondBest = bestPrice; bestPrice = bid; bestSocket = socket; } else if (bid > secondBest) { secondBest = bid; }
Rozumiem, poprawka wprowadzona.
if (bid > bestPrice) { secondBest = bestPrice; bestPrice = bid; bestSocket = socket; } if (bid < bestPrice && bid > secondBest) { secondBest = bid; }
Gdy bid == aktualny bestPrice -> secondBest nie będzie poprawnie wyliczony. Tak będzie ok: if (bid > bestPrice) { secondBest = bestPrice; bestPrice = bid; bestSocket = socket; } else if (bid > secondBest) { secondBest = bid; }