diff options
Replaced ugly multiplication and addition assignments
1 files changed, 3 insertions, 3 deletions
| -rw-r--r-- | Year 1/Programming introduction/Homeworks/homework1.cpp | 6 |
diff --git a/Year 1/Programming introduction/Homeworks/homework1.cpp b/Year 1/Programming introduction/Homeworks/homework1.cpp index d1ee749..d9541eb 100644 --- a/Year 1/Programming introduction/Homeworks/homework1.cpp +++ b/Year 1/Programming introduction/Homeworks/homework1.cpp @@ -149,7 +149,7 @@ void readCodesAndCountMarmalades(unsigned int archiveLength, unsigned int *blueb else if (typeDigits < 4) { typeDigits++; - (type *= 10) += digit; + type = type * 10 + digit; } else if (typeDigits == 4) { @@ -284,9 +284,9 @@ void countBullsAndCows(int secretNum, int guess, int *bulls, int *cows) *bulls += 1; else { - (secretCows *= 10) += secretNum % 10; + secretCows = secretCows * 10 + secretNum % 10; // If the guess (and secret) can have duplicate digits, this should be done only with the unique ones - (guessCows *= 10) += guess % 10; + guessCows = guessCows * 10 + guess % 10; } secretNum /= 10; |
