Don't know how to get started

Greetings everyone!

I'm currently learning C++, and I have just passed the topic 'Pointers'. I have no problems understanding, when I'm reading sample codes or others codes (at my level), but it's really hard for me to create simple programs from scratch. I just don't know how to put it all together.

Do you guys have any tips how to fix my struggle?
What works for me is to put the problem down in pseudo code. Then, fill in the syntax where the pseudo code is.

In your pseudo code, capture what the program needs to do. Ask yourself these questions:

1
2
3
4
5
6
7

What problem is the program supposed to solve?

What inputs does the program need to handle?

What outputs does the program need to handle?


These of course are just the basic questions.
I had the SAME issue you are having when I first started. I didn't a lot of research why I wasn't getting it (enough to be able to code on my own). So I started on YouTube learning from "thenewboston". He is a GREAT tutor and taught me A LOT of what I currently know. He breaks things down and in a fun way, but DO NOT just look at it and not try coding it.
I say at first code side by side with him but switch around some variable names to fit your preference. Keep doing this and REALLY learn the concepts of your "if" statements, "if/else", "while", "do while", "for" loop, etc.
I did this for 4-8hrs Mon-Fri, within no time I was coding pretty damn good programs. And you will too. Just keep at it and DO NOT give up.
I think the problem is you're trying to put pointers in anyway.
Pointer is a very powerful tool in C/C++, but it's not for everywhere.

In my understanding, pointers shall only be used when:
a) You want to persist data in memory
b) You want to transfer ownership of the data in memory
c) You're using dynamic binding (like overriding)

For a), the most common scenario is you have a function to create something, and you want to store it for later use, and you'll eventually delete the data somewhere later.

For b), you'll want to pass something to a function or interface or something else, and forget about the data. (like PostMessage in Windows Programming)

For c), if you want to use inheritance to call virtual functions, for the most time you have to use the pointer to base class.
Thanks everyone for the great answers. I'd appreciate it :)
Topic archived. No new replies allowed.