How can I get better at writing C++ and C# code from scratch?
Asked by
MellowQuasar47
I'm a second-year computer science student. We learned C++ during my first year, and now we're studying C# while still using C++ for data structures and algorithms. I can follow tutorials and understand what each line does, but I struggle to start a program on my ownโeven something simple like rock-paper-scissors. Video tutorials make sense while I'm watching them, but I have trouble applying the ideas independently. How should I practice and learn more effectively?
Answers
Thereโs a normal gap between recognizing code in a tutorial and generating it from scratch. After learning a small topic such as loops or functions, close the tutorial and recreate a simple example from memory. Then change itโuse different inputs, add a feature, or combine it with another concept. Struggling and debugging are part of the learning process, not signs that youโre incapable.
Reply to this answer
Use a book or well-organized written resource alongside your classes so you understand the fundamentals instead of only memorizing syntax. Before coding, describe the program in plain language: what data it needs, what steps should happen, and what the result should be. You can think of it like writing a recipeโthe variables are the ingredients, the functions are the steps, and the program carries out the recipe. This makes larger problems feel less overwhelming.
Reply to this answer
For data structures and algorithms, begin with easy exercises and give yourself time to solve them before checking an explanation. Write down the problem, break it into smaller tasks, and test each part. Donโt worry about finding the perfect architecture yet; focus on making a clear working solution, then improve it. Regular hands-on practice matters much more than finding the perfect instructor or video series.
Reply to this answer
The biggest change is to stop treating coding as something you mainly watch. Start with tiny programs: print a greeting, ask for a name, make a calculator, or create a number-guessing game. Write them yourself, even if you make mistakes. When you get stuck, look up only the specific concept you need instead of copying the entire solution. That practice builds the skill of turning an idea into code.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowQuasar47: I understand tutorials when I follow them, but I still feel lost when I have to make something independently. Iโll try planning the steps in plain language first.