Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Programming introduction / Homeworks / homework1.cpp
diff options
context:
space:
mode:
Commit604fd500943cae209b8a0f6e99fcd5510ad7e501 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-24 17:27:35 +0200
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-24 17:27:35 +0200
Files18549a989337c0e405b02963d0a198e2c840df49 /Year 1/Programming introduction/Homeworks/homework1.cpp
uni-projects-604fd500943cae209b8a0f6e99fcd5510ad7e501.tar
uni-projects-604fd500943cae209b8a0f6e99fcd5510ad7e501.tar.gz
uni-projects-604fd500943cae209b8a0f6e99fcd5510ad7e501.zip
Parent3c9dafd3d2977d4ac922886b0b00b566cd5288c1 (diff)
Replaced ugly multiplication and addition assignments
1 files changed, 3 insertions, 3 deletions
-rw-r--r--Year 1/Programming introduction/Homeworks/homework1.cpp6
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;