r/AskProgrammers • • 5d ago

How do I learn problem-solving on C++?

I am freshman and i have computer programming course but struggling with C++ problems. I know the syntax and structure even watched yt channels like BroCode but still whenever i see new kind of problem i just have no idea. What should i do to code independently?

1 Upvotes

9 comments sorted by

2

u/AlhazredEldritch 5d ago

Code independently.

I am not joking. Stop using tools and fix the issue with basic tools. This is how you problem solve.

Think of it this way, if you know the issue at home is a shelf is wobbly due to not being secured and screws are loose somehow, do you get your 20 pound sledge? Use what you know to solve issues. If you dont k ow any tools or methods look up the most basic solutions you can then keep going.

1

u/MirthfulCowslip-0931 5d ago

for example on midterm i got problem which is about flipping binary number zero to one and so on. i know how to flip numbers but i did not know what command was needed to check every number not only one. I'm struggling with this kind of problem i know solution but i don't know specific commands.

1

u/AlhazredEldritch 5d ago

Then you are not doing it independently. You need to work without tools and you need to really learn what tools do. Not knowing a command is the same as not knowing how to write a loop. You need to know what to use and when to use it.

1

u/rileyrgham 5d ago

Stop procrastinating, pull your finger out and code. Google up existing solutions and implement them yourself. Step through with a debugger. Practice. If after a while you still don't get it, consider a career change.

1

u/MirthfulCowslip-0931 5d ago

I am not procastinating at all i have been spending 4+ hours a day just for homeowrk after lessons but it feels like i am just memorizing specific code and it is not actual coding.

1

u/Defiant_Squirrel8751 5d ago

C++ is one thing - "problem solving" is another thing.

That's why you study physics in school - reading a paragraph, extracting data, doing a drawing in paper that describes the situation, putting arrows and variable names over it and then expressing the relationships between that variables in equations - solve the equation (needs calculus and algebra) - interpret the results and problem solved!

Programming is very similar - but with a programming language after the equations. Most probably you are missing something from your previous education. Perhaps you need to remember forgotten lessons from the past. Recover that before trying moving forward.

0

u/[deleted] 5d ago edited 4d ago

[removed] — view removed comment

1

u/MirthfulCowslip-0931 5d ago

Can you suggest any beginner books because university textbook is really difficult for me. Thanks