C++ Going Beyond Basics

Started by
19 comments, last by Alpha_ProgDes 7 years, 7 months ago
A question I always wanted to ask developers: As a beginner, how did you go beyond basics?

I started with the Hello World code, then learned more and created a program on my own where the program asks questions and you answer (input, output).

I have difficulties going beyond that. What I mean is, I do not have any ideas of what I should code next...Sadly a lot of developers give too many advices that confuse the heck outta me, you can say they forgot how it was like to be a beginner...

Not just C++, but the entire programming as a whole.

I'm planning to buy this book: http://www.cprogramming.com/c++book/?inl=ft-nhp

Plus I want to learn the hard way, like most developers did, I don't want a website like Code Academy where it gives me hints and answers...that won't help me learn as much, because part of Coding is about problem solving.

what's your advise?

Advertisement

The world is full with problems you can program, just follow your heart. What problem do you like to solve?

In game context, you could consider hang man, text adventure which should be feasible at the console.

Other options are fifteen puzzle, or 2048, which you theoretically can do at a console, but you may want to add a graphics display there, like SDL or SFML.

Beyond that, tetris, pong, space-invaders

If you don't know programming, C++ is a terrible language to learn. I would start by learning a friendlier language first. Python is often suggested for this purpose, but I don't think there is anything wrong with learning C, for instance.

I think you have the right idea in trying to find projects that motivate the learning of different concepts.

Beyond input and output, try to learn:

* Loops (make a multiplication table)

* Fancier loops (test if a number is prime by trying to divide it by trial division)

* Functions (learn to organize your code in understandable chunks with a good name and a clean interface, provided by the parameters and the return value of the function)

* Data structures (things like arrays, lists and trees; but the details depend on the exact language you are working with)

* File I/O (process a text file and count how many characters, words and lines it contains)

It doesn't matter what language I learn because all of them have the same exact logic...the only difference are the way you type the code.

instead of: cout <<"hello, world" << endl

you type: print "hello, world"

It's not about languages I have difficulties with, it's the ideas. I can't think of a project to start coding.

And about python...I know it's easy, but I recommend to teach myself the new language "Swift" since it's as easy but modern.

The first programming language I learned was Java, then moved to C++ for game programming reasons, I did not start with Python or other languages.

And yes loops, functions, generics, pointers...they can't enter my head...(can't understand them)..

It doesn't matter what language I learn because all of them have the same exact logic...the only difference are the way you type the code.

instead of: cout <<"hello, world" << endl

you type: print "hello, world"


Yes, those things look superficially similar. But then you need to worry about whether `cout' and `endl' are visible or if you need to specify the `std::' in front, what that `#include <iostream>' means, whether you should be using `endl' or "\n" or '\n', what the hell `std::ostream &operator<<(std::ostream &, MyType)' means when you are trying to print your own type, etc., etc.

C++ is very unfriendly to beginners, and trying to learn fundamental programming concepts using it is a handicap that you do not need.

A question I always wanted to ask developers: As a beginner, how did you go beyond basics?

I started with the Hello World code, then learned more and created a program on my own where the program asks questions and you answer (input, output).

I have difficulties going beyond that. What I mean is, I do not have any ideas of what I should code next...Sadly a lot of developers give too many advices that confuse the heck outta me, you can say they forgot how it was like to be a beginner...

Not just C++, but the entire programming as a whole.

I'm planning to buy this book: http://www.cprogramming.com/c++book/?inl=ft-nhp

Plus I want to learn the hard way, like most developers did, I don't want a website like Code Academy where it gives me hints and answers...that won't help me learn as much, because part of Coding is about problem solving.

what's your advise?

Read more books.

Get to know more-> Frameworks, languages, technologies.

Read others code. Read open source projects and maybe try to get into one.

I think going beyond the basics requires encountering a need to go beyond the basics, that way you hit the inevitable question of "how do I achieve this thing?" and then you hit up Google and learn something new.

To do that you need a project. Perhaps you should try and make a pong or tetris clone. Or even a non-game application that does something you're interested in: could be a program to calculate digits of Pi, or a chat client/server, or a financial bookkeeping database.

It doesn't matter what language I learn because all of them have the same exact logic.

Oh I wouldn't be so sure about that :wink:
Not all programming languages are born equal. Take a quick peek at Haskel or Prolog for example.

..the only difference are the way you type the code.

instead of: cout <<"hello, world" << endl

you type: print "hello, world"

Well, your Python example is already a full working program!

So to compare apples-with-apples, in your C++ example...

  • you need to #include iostream
  • you need a main() function with an int return type (but you don't need a return statement, obviously).
  • you're missing the std namespace qualifier, either that or you're missing a using statement.
  • some other noteworthy things: you're using a streaming API here, you're using a string literal not a string object, you're using std::endl which is actually a function, the << operator is actually a function call.

And that's just for hello world! :blink:
In C++ land this is actually very tame and doesn't even scratched the surface of the complexities that await.

I am lucky that I don't have to code in C++ regularly and in an ideal world something like Rust would replace C++.
I advise that you don't make life harder for yourself as a beginner. Learn C++ later by all means but get the basics down first, you'll shave years off your learning curve.

And about python...I know it's easy, but I recommend to teach myself the new language "Swift" since it's as easy but modern.

Swift is a nice language, but do you have a Mac? If you're on Windows then it's not yet really an option.

The first programming language I learned was Java, then moved to C++ for game programming reasons, I did not start with Python or other languages.

Java is a great 1st language IMO. It's also great for games.

My entry for the Week of Awesome competition was written in Java. And probably Minecraft is the most contemporary example of a popular Java game.

It's also the language of Android, incase creating Android apps was of any interest to you.

And yes loops, functions, generics, pointers...they can't enter my head...(can't understand them)..

That's your initial focus then!

If I were you I would swing back to Java (since you're already familiar with it) and learn how these fundamental concepts work. Build up a solid knowledge foundation and make some cool stuff in the process.

If you don't know programming, C++ is a terrible language to learn. I would start by learning a friendlier language first. Python is often suggested for this purpose, but I don't think there is anything wrong with learning C, for instance.

I think you have the right idea in trying to find projects that motivate the learning of different concepts.

Beyond input and output, try to learn:
* Loops (make a multiplication table)
* Fancier loops (test if a number is prime by trying to divide it by trial division)
* Functions (learn to organize your code in understandable chunks with a good name and a clean interface, provided by the parameters and the return value of the function)
* Data structures (things like arrays, lists and trees; but the details depend on the exact language you are working with)
* File I/O (process a text file and count how many characters, words and lines it contains)

C++ is a GREAT way to start coding. You learn about how a program behaves, instead of being stuck by rules. Once you understand how a program works, the rest is syntax.

Sure, memory manipulation, stricter syntax, no safety nets, etc. But, it's best to learn WHY you need to do /that/ instead of being told "its bad".

I always recommend starting with C or C++, then understanding the basics of x86/x64 Assembly. Seeing how a program works, is far better than being told "it works".

Edit: To the OP. Have you done classes and inheritance? The cpp standard? STL? Win32/x11? There's far and far more to learn. Master what you know now, then move on. I highly recommend learning the cpp standard first. Then move on to the area you like (sound, opengl/directx, vulkan, etc), api programming, so forth). Learn to structure code throughout files. Can you write a number guess game via std::cout? Try that. Then move on.

Which language to use is kind of a personality thing. I've seen people who swear by C++ as a starting language like MarlboroKing. For some people, that might be the right path. It's a good path although maybe not the easiest. And as difficult as it is, it may discourage beginners (and getting so discouraged that you quit is not good).

I started in Basic and wrote a lot of spaghetti code as a kid. They made me do Pascal in school, which I came to love (and taught me proper structure). Then I did C and Assembler (which taught me to comment to the n-th degree) in school which better fits my personality. Then I moved on to C# which helped me a lot with Object Oriented Programming. Now I do C++ and prefer that. It's pretty natural for any programmer to move through languages. The important thing is that you pick one and stick with it long enough to learn it. Then you can move on to something that better suits you as you learn what's right for you.

I do somewhat agree that all languages are just a means to an ends, but I think for a lot of people it's easier to start with an easier language so that they can enjoy what they are doing and not get so frustrated that they quit.

I do database administration as a profession. Programming is what got me into that world. I do some programming professionally but not alot.

But I program as a hobby. For me, I could never do business programs "for fun". I need game programming to encourage me to spend time coding, because I find that rewarding. It encourages me to code in order to bring my ideas to life.

If video game programming is what you want to do, recreating old and fairly simple games is a good way to get experience. Pong and Space Invaders is where the industry started, and likewise you will probably have to start at the beginning and build up.

I wouldn't worry too much about "inspiration" in game programming. As your skills develop, you'll broaden your abilities and inspiration will come. You just have to work on projects that are fun.

Sometimes, you have to increase your skills to get there though. I'm doing 3D modeling now, which was difficult for me. I was in a catch 22 where I needed to practice to get better, but my skills were so terrible that practicing wasn't fun because I couldn't model anything. So, I'm enrolled in a class. My skills are starting to get to a level where I can model things that are interesting which inspires me to spend time practicing.

I've done coding so long that I hardly even remember what it's like to start out, but I think it's similar; by taking classes and improving your skills your abilities will increase which will allow you to work more on what you want to work on. Then you'll be more inspired to practice and work on your own projects.

Maybe try Unity where you can do C# or Java scripting. It's a "relatively" easy way to start and can easily lead to inspiration since it's fairly easy to do things in Unity compared to other ways of game programming.

Maybe try Unity where you can do C# or Java scripting. It's a "relatively" easy way to start and can easily lead to inspiration since it's fairly easy to do things in Unity compared to other ways of game programming.


Unity has C# scripting and JavaScript scripting. It does not support Java. I'm not sure if that was a typo, but I don't think so since the OP was talking about knowing Java. Just wanna keep facts straight.

This topic is closed to new replies.

Advertisement