this post was submitted on 04 Jul 2023
15 points (100.0% liked)
Programming
13385 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
After a few hours of work, I was able to improve the code by following your recommendations. I was genuinely surprised at how removing boilerplate code that I created at the beginning helped me see where the problems are and allowed me to see better solutions to problems.
For example: instead of copying each value into a temporary
int
array, sorting that array and then changing the original, I was able to just use C++ STL sort() with a function parameter to automatically sort structs based on their values when it came to the rows.I touched on every point that you've made and made changes accordingly, some things like the
char option
I just removed and checked for the conditions in the function instead of waiting for the programmer to give the correct answer. The only thing left for me is to relax a bit since I was at it for a lot of time, and then properly comment the code.