Feedback Wanted on My First C++ Number Guessing Game

0
8
Asked By CoderKid123 On

I'm 13 years old and have been learning C++ for a few weeks! I just finished building my first console-based number guessing game where players can choose from Easy, Medium, or Hard difficulty levels. It handles input in a case-insensitive manner, allows for replaying, and uses random number generation. Although it's just a small project, I aimed for clean structure and made use of the Standard Template Library where possible. I would love to get your feedback on my:
- Code structure
- Areas for improvement
- Any bad practices I might have overlooked
If you're interested, you can check out my GitHub repository here: https://github.com/Minato-Shadow/My-Coding-Journey. Thanks a lot!

5 Answers

Answered By TechGuru42 On

Hey! Your project is impressive for someone your age! Your code looks solid and it's nice to see it function as intended. One tip: consider refactoring parts of your code to remove duplication. For instance, in your difficulty settings, it helps to consolidate repeated lines, like the random number generation based on max_num. Keep practicing, you're doing great!

CoderKid123 -

Thanks for the suggestion! I'll definitely consider that.

Answered By DevMasterJoe On

Good job on creating this game! Just a heads up, while you want to document your code, remember that it's best to explain 'why' you did something, rather than what the code does—since that's usually clear from the code itself. Plus, maybe spruce up your README file a bit; it seems a little generic right now. Keep at it!

CoderKid123 -

I appreciate the feedback! I’ll work on updating my README.

Answered By CodeWhiz On

Nice work with your game! Make sure to handle any edge cases in your input; for example, ensure you're checking that the user enters valid numbers. It might also be helpful to learn about testing practices and continuous integration. This will give your project a professional touch!

CoderKid123 -

I’ll look into that for sure, thanks!

Answered By CplusplusNinja On

Great start! Quick note: in your code, avoid using 'magic numbers'. For example, if you'd like to change the number of tries for difficulties, store those numbers in constants. This makes your code cleaner and easier to maintain. Keep pushing yourself and you'll keep improving!

CoderKid123 -

Thanks for this tip! I'll definitely implement constants!

Answered By FuturePro On

Awesome work getting into programming at such a young age! Just a tip: avoid falling into the trap of relying too much on tutorials. Try to tackle projects independently and use online resources as a backup when you hit roadblocks. That's how you'll really learn! Good luck with your future coding adventures!

CoderKid123 -

Thank you for the encouragement!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.