I just started learning C++ and we are two weeks into topics like loops and sentinel values. I usually follow the lectures and can reproduce examples on my own computer, but homework feels completely different. When I open a blank file, even tasks involving concepts I understood in class can feel impossible, and I end up wanting to look up basic syntax such as how to write a do-while loop. I am a perfectionist, so this gap is frustrating. I have experimented with C++ outside of class, but I still feel like I am struggling. How did you practice until programming started to feel more natural? Are there any books, exercises, or beginner-friendly resources you would recommend?
4 Answers
Two weeks is an extremely short amount of time. The difference between following someone else's example and creating a solution from a blank file is real, and it takes practice. Try rewriting lecture examples from scratch without looking at them, then make small changes and see what happens. A simple personal project can also help because it gives you a reason to keep working through problems instead of making every exercise feel like a chore.
Practice is the main answer, but try to make it active practice rather than just watching more explanations. Build something small and fun, such as a simple number-guessing game, a score tracker, or a program that processes a small list of data. You do not need to memorize every keyword, and you should not feel guilty about consulting documentation or a beginner reference. After a couple hundred hours of focused practice, many people notice that the concepts start connecting, but there is no universal deadline or single moment when it suddenly happens.
There is a difference between recognizing a solution and producing one. A lecture gives you a guided path, while homework asks you to decide what the steps should be, choose the right tools, and write everything down. That gap does not mean you failed to understand the lesson. Start by breaking each assignment into tiny pieces: describe the goal in plain language, write pseudocode, then implement one piece at a time. Asking your professor what fundamental concept feels unclear is also a good idea—they will likely appreciate that you are trying to understand rather than just chase a grade.
Looking up syntax is completely normal and isn't the same as having someone do your homework. It is fine to search for the structure of a loop or the signature of a function, even experienced programmers forget syntax they do not use often. The important part is understanding what the loop or function is supposed to do and being able to adapt the example yourself. Over time, the syntax you use regularly will stick.

That comparison makes sense. I have had a similar experience learning other difficult subjects, where the basic building blocks eventually became clearer. I think I am expecting that feeling to happen sooner than it realistically will.