So I’m a HTML web developer that decided to try programming... and to be quite honest I’m terrible. I’m learning C++ right now, and I’m trying to write a program where you input into console your name and age, and when you do the program then states “Hello name, in five years you will be x age” so the program displays your name, and what your age will be five years after the input age.
I just don’t get the some of the syntax for the language, and being a visual learner if possible could someone explain to me how to set this up, and how?
The secret to being a good developer is to realize that coding is 90% thinking, and only 10% typing.
Never start off a project trying to figure out the syntax. Start by writing out in English (or your natural language of choice) what you want to do, step by step. Then revise those steps into smaller steps. Keep revising it until your steps are clear enough that a 10 year old child (or a 5 year old) can understand them, follow them, and have no questions about what to do next.
If you have access to such a child, give it to them and see how many errors and omissions you have, then repeat.
Eventually, you will have a pretty well defined list of steps.
Then start coding, but only in the smallest amount possible before you compile, test, debug, repeat until it's perfect. If I were doing this project, on my first pass, i would have the code print nothing more than a simple "hello".
Once that worked, change it to print "Please enter your name: " (or something like that). At this point, i'm not trying to GET the name, i'm merely asking the question. Once THAT works, I add the next piece. I may think "ok, i know how to ask for a name, so asking for age shouldn't be that much harder, so i'll work on getting the name". Once i can get it and save it, then hopefully doing the same two steps for age will be easier.
Try that. see how far you can get. When you have something and get stuck, post your code here and someone will help you further.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Evacuate the building! Here, take this tiny ad with you: