From 604fd500943cae209b8a0f6e99fcd5510ad7e501 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 24 Nov 2021 17:27:35 +0200 Subject: Replaced ugly multiplication and addition assignments --- Year 1/Programming introduction/Homeworks/homework1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Year 1/Programming introduction/Homeworks/homework1.cpp') 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; -- cgit v1.3.1-23-gd82d