Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Snake X on November 04, 2011, 09:23:38 pm

Title: best way to learn C++?
Post by: Snake X on November 04, 2011, 09:23:38 pm
Well, It's time I learn something valuable in life a little early.. C++! So I found out that one of my friends is making this game with like 3 or so other people and i wanted to help him out.

So, what is the best online tutorial that will help me to learn this language? Also what IDE is the best one? What do I need to download to get started making my first programs?

Thanks as always!
Title: Re: best way to learn C++?
Post by: BlakPilar on November 04, 2011, 10:01:16 pm
I suggest cplusplus (http://www.cplusplus.com/doc/tutorial/) and learncpp (http://www.learncpp.com/). I'm not a master of the language, but I'm using those two to learn it, and I'm using Code::Blocks (http://www.codeblocks.org/downloads/26) as my IDE. If you go with Code::Blocks, I think you only need to download that to get started. cplusplus has a PDF of their tutorial that you can download for offline learning, if you wanted though.
Title: Re: best way to learn C++?
Post by: Scipi on November 04, 2011, 10:22:00 pm
cplusplus is probably the best tutorial out there. For an IDE I use code::blocks with MinGW included in the install. :D
Title: Re: best way to learn C++?
Post by: Snake X on November 05, 2011, 09:23:50 am
thank you! Tomorrow i'll probably start on it.

Also, what about tutorials as far as direct3d 9/10/11? Which tutorials are the best ones for that? The reason I wanted to learn about C++ is to work with direct x
Title: Re: best way to learn C++?
Post by: sammyMaX on November 05, 2011, 09:44:08 am
Just download the DirectX SDK, and open the samples and test things out. The included documentation also helps you quite a bit when looking through the samples (start with the tutorials)
Title: Re: best way to learn C++?
Post by: Snake X on November 05, 2011, 09:46:46 am
ok, thanks! I'll look into it after i learn c++ first tho
Title: Re: best way to learn C++?
Post by: Scipi on November 05, 2011, 10:33:02 am
Just a forewarning, DirectX and OpenGL are highly complex libraries. You may want to start out with something like Ogre3D or the like to learn the basics of 3D Graphics.
Title: Re: best way to learn C++?
Post by: Munchor on November 05, 2011, 11:19:24 am
I also don't recommend DirectX because it's a Microsoft library that only works on Windows. OpenGL is a far better choice, due to having the same power and being cross-platform ;)
Title: Re: best way to learn C++?
Post by: thepenguin77 on November 05, 2011, 11:21:29 am
For a tutorial, I used LearnCpp (http://www.learncpp.com).

For an IDE I used Visual Studio. Visual Studio works great if you are only going to develop for windows, if you are going to develop for other platforms, then code::blocks is probably your best bet. (Ha, now you can't yell at me)
Title: Re: best way to learn C++?
Post by: Munchor on November 05, 2011, 11:44:43 am
For a tutorial, I used LearnCpp (http://www.learncpp.com).

For an IDE I used Visual Studio. Visual Studio works great if you are only going to develop for windows, if you are going to develop for other platforms, then code::blocks is probably your best bet. (Ha, now you can't yell at me)

As soon as I saw you replied I thought "Brace yourself, he just recommend Visual Studio!". But this time you did it well.

Another advantage of Code::Blocks is if you use it on Windows, and then have to use Linux or Mac for something else, then you are accustomed to the IDE already ;)
Title: Re: best way to learn C++?
Post by: Levak on November 05, 2011, 12:18:41 pm
No troll, but, the best IDE ever is emacs or vlm.

Using all this kind of IDE makes you forget what you're doing.
Title: Re: best way to learn C++?
Post by: Scipi on November 05, 2011, 12:35:26 pm
Whatever you use, don't forget to ask questions here if you need help on something. :D (Answering C++ questions makes me feel useful here, lol) :P
Title: Re: best way to learn C++?
Post by: Snake X on November 05, 2011, 08:53:31 pm
ephan, problem is, is that my friend is working on a game that uses direct x 9. Also i like direct x. A lot. lol

Ok another question:

how would I make a multi-core "hello world" program?

For example, I would want 1st core to print "Core 1 says Hello world!"
2nd core would print "Core 2 says hello world!"

and etc, all of which is printing out to the console (command prompt i thin)
Title: Re: best way to learn C++?
Post by: Binder News on November 05, 2011, 10:06:44 pm
To do something like that, you would need to make multiple threads. I'm using Linux nowadays, so I would recommend the pthread library. I'm pretty sure VS has it, and I know Code Blocks has it. Just include pthread.h. Look on Wikipedia for some quick example code.
Also, you can't force the program to make a thread run on a specific core. You just have to trust that it will do it's job (the same goes for all threading libraries).
Title: Re: best way to learn C++?
Post by: willrandship on November 05, 2011, 10:12:21 pm
Cplusplus is actually used by my high school.

And with more complex threading, you have to keep in mind certain timing issues, such as that sometimes (not usually) core 2 responds first, which could really screw with you in some situations.
Title: Re: best way to learn C++?
Post by: Snake X on November 05, 2011, 11:09:31 pm
well thats fine, just as long as it can display the text really

edit: i found out that pthread.h is linux only.. which one is the windows version?
Title: Re: best way to learn C++?
Post by: willrandship on November 05, 2011, 11:21:50 pm
Apparently it doesn't have its wn lib: Here's a tut.

http://msdn.microsoft.com/en-us/library/ms810438.aspx
Title: Re: best way to learn C++?
Post by: Snake X on November 06, 2011, 07:39:21 pm
Ok well the tutorial from cplusplus isn't working out for me as of this moment.. I gotten to as far as pointers with functions but then it just started to make no sense to me and i feel like it wasn't explained that thoroughly. It was "targeted" for people who had no prior coding experience but i don't think that is the case.. lol
Title: Re: best way to learn C++?
Post by: Scipi on November 08, 2011, 02:21:34 pm
What part about pointers or functions are you having trouble with? Perhaps we could explain more in depth?
Title: Re: best way to learn C++?
Post by: Munchor on November 08, 2011, 04:40:53 pm
Ok well the tutorial from cplusplus isn't working out for me as of this moment.. I gotten to as far as pointers with functions but then it just started to make no sense to me and i feel like it wasn't explained that thoroughly. It was "targeted" for people who had no prior coding experience but i don't think that is the case.. lol

I was already a programmer when I read it, and it was just fine, it's what made me understand pointers for life, and English isn't even my main language.

Secondly, if it was written for people with no prior coding experience (as you stated), then it should also be just fine for programmers. It would be awkward for non-programmers to read a text targeted to programmers, though.

Nevertheless, as HOMER-16 said (http://ourl.ca/13819/260020), what didn't you understand? We might be able to explain more "thoroughly".
Title: Re: best way to learn C++?
Post by: willrandship on November 14, 2011, 06:52:47 pm
Pointers work the exact same way as they do in axe, if it helps.
Title: Re: best way to learn C++?
Post by: calc84maniac on November 14, 2011, 07:14:33 pm
Pointers work the exact same way as they do in axe, if it helps.
Well, except that adding to a pointer will automatically multiply by the size of the data being pointed to. No difference if it's a single byte pointer, of course.