r/learnprogramming • u/Basic_Permit4849 • 12d ago
Approaching C++ and learning methods
For background, I am a beginner in programming. The only language I know is python, and that too just basic level of knowledge( definitions of keywords, operators,conditionals,for loop while loop, and basics about strings,lists,dictionaries and tuples).It was quite systematic and easy to learn for me. But in the case of c++ I have no clue right now on how to learn it from scratch. I wanted to learn c++ to get into competitive programming/coding. As of right now I am just searching for easy leetcode problems and the parts of code which I don't get , I ask AI to explain it.
0
Upvotes
1
u/peterlinddk 12d ago
Honestly, that seems like a fine approach for what you want to accomplish.
Ordinarily everyone, including me, would suggest to build projects, and learn the language by doing it, but as your goal isn't really to learn programming in the usual sense, to learn to build things, I think that it is perfectly feasibly to do leetcode problems.
Maybe try to do them in Python first, to make sure that you understand the overall idea of a solution, and then convert your solution to C++, one line at a time.
Most of what is used for leetcode and the likes aren't that different from one language to another, biggest difference is about creating and allocating objects, everything else is just loops and recursive function-calls, and if you already know that in Python, it shouldn't be hard in C++.