Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Programming introduction / Homeworks / homework1.cpp
diff options
context:
space:
mode:
Commit237bac8e9055e49a2b7ed12d7e65c7db031e2b26 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-24 17:27:55 +0200
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-24 17:27:55 +0200
Files6c0e0533cd1af9c2484ddfe623e5b53433a3f8fa /Year 1/Programming introduction/Homeworks/homework1.cpp
uni-projects-237bac8e9055e49a2b7ed12d7e65c7db031e2b26.tar
uni-projects-237bac8e9055e49a2b7ed12d7e65c7db031e2b26.tar.gz
uni-projects-237bac8e9055e49a2b7ed12d7e65c7db031e2b26.zip
Parent604fd500943cae209b8a0f6e99fcd5510ad7e501 (diff)
Made some pointers constant
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 d9541eb..c64f169 100644
--- a/Year 1/Programming introduction/Homeworks/homework1.cpp
+++ b/Year 1/Programming introduction/Homeworks/homework1.cpp
@@ -49,7 +49,7 @@ void printPointLocation(double x, double y) {
{
double pointSlope = y / x;
- // Brackets in some places for improved readability
+ // Added brackets in some places for improved readability
if (eq(x, -CROSS_PNT) || eq(x, CROSS_PNT) || eq(pointSlope, SLOPE_BC) || (eq(pointSlope, SLOPE_DE) && mt(y, 0)))
{
cout << NOWHERE << endl; // On a line
@@ -122,14 +122,14 @@ void ex1()
* Exercise 2
*/
-void setMarmaladeType(unsigned int type, unsigned int *blueberryMarmalades, unsigned int *peachMarmalades, unsigned int *rosehipMarmalades)
+void setMarmaladeType(unsigned int type, unsigned int* const blueberryMarmalades, unsigned int* const peachMarmalades, unsigned int* const rosehipMarmalades)
{
if (type % 7 == 0) *blueberryMarmalades += 1;
else if (type % 13 == 0) *peachMarmalades += 1;
else if (type % 17 == 0) *rosehipMarmalades += 1;
}
-void readCodesAndCountMarmalades(unsigned int archiveLength, unsigned int *blueberryMarmalades, unsigned int *peachMarmalades, unsigned int *rosehipMarmalades)
+void readCodesAndCountMarmalades(unsigned int archiveLength, unsigned int* const blueberryMarmalades, unsigned int* const peachMarmalades, unsigned int* const rosehipMarmalades)
{
archiveLength -= archiveLength % 8; // The last code could be invalid (shorter than 8 digits)