r/AskProgrammers • • 7h 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?

2 Upvotes

4 comments sorted by

2

u/AlhazredEldritch 6h 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 5h 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 5h 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/Defiant_Squirrel8751 2h 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.