r/cpp_questions • u/Tw1lightt69 • 17h ago
OPEN How can I learn to think logically when solving programming problems?
At college, I try to study as hard as I can; during computer science and programming classes, I make an effort to grasp every topic, and I practice a lot at home—even using an AI assistant—but it all feels like it’s for nothing. When it comes to practical assignments, I just can’t seem to formulate the code. What should I do?
5
u/Independent_Art_6676 12h ago
find problems that you can do with a bit of work. Not so hard it takes forever or that you need help, and not so easy that you can do it in your head before typing a line of code. Repeat. You get better by doing and thinking, and get away from the AI. AI is a great tool after you get better, but early on, its a distraction and a crutch and it will prevent you from thinking for yourself.
3
u/tickle-fickle 11h ago
Start simpler then. If practical assignment are too difficult, and the process of translating what you have in mind into code is challenging for you, then you need to give yourself some grace and go slower.
What helped me a lot back in college is this silly exercise: role play as the compiler. Don’t try first to translate your thoughts into code, go the other way: translate the code into your thoughts, REALLY understand what is happening. The hope is that with enough training going one way, you’ll develop intuition on how to go the other way, the way that you actually wanna do. Like,
What would be the output?
Seriously, grab a pen and paper and just go line by line, track the value of each variable. And then run it, see if you’re correct. Then try harder examples, look for sample code of idk, bubble sort, and do the same. You got this!