Struggling with "Passive Understanding" – Can understand C++ code but can't write it myself. Advice?
Posted by tadipaar69@reddit | learnprogramming | View on Reddit | 12 comments
Hi everyone,
I’m a CS student from India currently learning C++ with the goal of getting into DSA and eventually LeetCode for job placements.
I’ve run into a massive wall: I understand 100% of the code when I see it in a tutorial or read it in a book. The logic makes sense when someone explains it. However, the moment I open a blank IDE to write it myself, I freeze. I especially struggle with translating logic into syntax, particularly with conditionals and nested loops.
I feel like I’m lagging behind my peers and moving way too slowly. Is it normal to be "literate" in C++ but unable to "speak" it yet?
For those who were "average" students or struggled with the logic at first, how did you bridge the gap between understanding a tutorial and writing original code? What specific exercises helped you start "thinking" in C++?
Thanks in advance!
unk214@reddit
Do the following:
Follow a c++ tutorial a few times.
Then follow the same tutorial without looking at their code, just the problem statement.
That’s pretty much it. Sounds like you’re memorizing terms and understand logic but you lack problem solving skills.
Another example: If I ask you to make me a black jack dealer algorithm where would you start?
tadipaar69@reddit (OP)
Got you i did the similar thing , but it justs gets too much cause when i’m following the tutorial tha person is writing code for every topic & i then skip some which i understand just by looking , but then i also tend to forget the logic or the topic i just dont know man i’m too overwhelmed my mind always goes to perfection learn 100% perfectly i just dont know whats wrong with me
unk214@reddit
There is nothing wrong with you, be patient and try to solve problems without looking at the answer.
Learning how to be good at programming is like learning math for the first time.
You may not remember but learning math as a young kid is difficult. Even adding and subtracting is confusing.
Present yourself with problems and solve them. Start small like the Fibonacci sequence, how would you code that in c++…. Then how would you make it efficient.
FlashyResist5@reddit
Write code that prints all the numbers from 1 to 10. Change the code so that if the number it is even it prints num is even otherwise num is odd. Change the code so that it goes from 10 to 1. Change the code so that you print from A0, A1, A2, B0, B1, B2, C0, C1, C2. Change that code so if the outer loop is B and the number is odd you print it twice.
And actually do this. In an ide. With no AI. Don’t just read this and say yeah I understand. Do it. Then come up with your own exercises.
aanzeijar@reddit
If you think you understand 100% of C++ code by simply looking at it, that basically means you do not know C++ at all.
ScholarNo5983@reddit
There are many billions of people in this world who have enough of a literacy capacity to read a book.
However, the number of people how have the "literacy capacity" to write that same book falls dramatically.
Reading has always been and will always be the easy part.
peterlinddk@reddit
This sounds extremely strange - it would be like being able to listen to a piece of music, and recognize the tune, but still being unable to play it yourself!
It is a very rare condition - most people would instantly gain the ability to do something, the moment they have seen the result of someone else doing it - I mean, every time I watch the olympics, I immediately go out and excel in all the different sports!
And come to think of it, most babies are able to speak the moment they hear other people talk - it is not like they apparently have to listen for months, and just try to make sounds and words themselves, constantly practicing, practicing, and practicing with gradually larger and larger words to get better.
I have no idea how to deal with not being able to do things, even if you are perfectly able to understand the results someone else comes up with. I guess, maybe trying to write small programs at first - small simple ones, go through a bunch of exercises, solving extremely simple problems like counting down from 100 or drawing rectangles using characters ...
aqua_regis@reddit
See this thread from yesterday and at this one also from yesterday.
In essence: you can read and understand a book, but could you write a meaningful, fully developed one?
Samee thing - these are two completely different skills that need individual training.
More-Station-6365@reddit
Went through the exact same thing. Understanding code and writing code are two completely different skills and nobody tells you that upfront.
What worked for me was closing the tutorial after reading a concept and writing it from memory without looking. Felt broken every time. That discomfort is where the actual learning happens.
For loops and conditionals specifically, write the same pattern ten different ways from scratch. Not modify, not copy. Fresh each time. Gets uncomfortable fast but the gap closes quicker than you expect.
syklemil@reddit
If you'd used the search function you'd know the answer to this already. A very important aspect of programming is being able to search for and discover information you need.
The answer, as always, is don't just consume. Practice. Produce.
JeLuF@reddit
Follow the advice that was given to you during the last two hours at https://www.reddit.com/r/cpp_questions/comments/1sgim5e/struggling_with_passive_understanding_can/
righN@reddit
Start doing projects by yourself, not by following tutorials. You'll struggle, but it'll get better.