Recommend me a C++ Book please :)

Soldato
Joined
2 May 2004
Posts
19,943
Hi,

I've been really interested in learning C++ recently.

I've been looking at some tutorials and some of them are good, but I'd really like to get a good book that would take me through from just about the beginning.

The best application I've made is a net sender - you type the name of the computer, then the message and it sends the message to the computer (I got a little help on the actual net send part of the code as it was fairly hard for a beginner, it wasn't completley straight forward, but I got there and it works perfectly). So basically the limit of my C++ knowledge at the moment is the ability to let a user input text and then for it to be outputted to a text file, or to be done something with.

Anyway, this book I'm looking for has to pretty much start from the beginning and work it's way onto making 'visual' applications (forms with buttons, text boxes, allowing a user to enter something into a text box and then the application does something useful with it etc.)

My first main project I want to do (when I'm not to nooby at C++ :p) is a KeyCounter - like the one PIQ Software made, something nice and simple that would use SetWindowsHookEx() to count. Then count them all up in it's own little database locally and then submit them to an online MySQL database.

Must be a good book that teaches you well and goes through making certain 'tutorial' applications with you so that you can, after you've read through it, make your own useful application.

Thanks,
- Craig.
 
Permabanned
Joined
9 Feb 2006
Posts
644
you wont find a c++ book that teachs you win32 programming , etc GUI
this is all done with windows API ,
in the c++ book you will just find all c++'s keywords and what they mean
so you need a c++ book and a windows api if you want to make programs that are like you say.
a very good refrence of all windows API
is on www.microsoft.com/msdn
and just do some googling for c++ guides
 
Last edited:
Soldato
Joined
18 Oct 2002
Posts
3,926
Location
SW London
May I ask why you want to use C++ if the ultimate goal is to be creating 'visual' applications?

Surely using C# would allow you to do this much more easily?
 
Permabanned
Joined
9 Feb 2006
Posts
644
no its not c that will create visual apps..
c is just standard c++ so how would you create visual applications..
windows api is what you want ,, etc CreateWindow is the one that will make you a box ...theres lots of api ,my book is 2000 pages long full of api
 
Permabanned
Joined
13 Jan 2005
Posts
10,708
Haircut said:
May I ask why you want to use C++ if the ultimate goal is to be creating 'visual' applications?

Surely using C# would allow you to do this much more easily?

I agree.

C++ is much better for server processes and that kind of thing. SImple guis are much better coded in a GUI orientated language.
 

Una

Una

Associate
Joined
26 Nov 2004
Posts
2,471
Location
Reading / Lake District
deitel and deitel how to program c++ is a decent beginners book.

Check out the tutorials at, http://www.gamedev.net/community/forums/forum.asp?forum_id=76

They are based round sams teach your self c++ book.

There are tutors there with a hell of a lot of experience if you get stuck.

As people have said, you will need to learn c++ first then learn something like winapi, qtWidgets or GTK for visuals. Windows API is a pain in my opinion, its really not the easiest to start with.

C#/Java however is better for what you want to do really, if you want these apps built quicker.
 
Soldato
OP
Joined
2 May 2004
Posts
19,943
Haircut said:
May I ask why you want to use C++ if the ultimate goal is to be creating 'visual' applications?

Surely using C# would allow you to do this much more easily?

Main reason I've been wanting to learn C++ is because I'm tired of making 'visual' applications that require bloody .NET framework. I really don't like having to get people to install .NET framework just to run the program.

I've got used to making the layout etc. using ResEd and then implementing it into my program and running it, that's all easy but what I need to learn is actual C++ code that will do things.

Maybe if I got a normal C++ book, which you guys have said just teach you about C++ not visual or anything, and learnt from that then I'd be able to put the code that i've learnt into my visual application?

(Sorry for late reply, broadband broke)

Una said:
As people have said, you will need to learn c++ first then learn something like winapi, qtWidgets or GTK for visuals. Windows API is a pain in my opinion, its really not the easiest to start with.

Basically my main aim is to make good useful applications in a language that doesn't require .NET so I decided to go on C++

So do you recommend I got a normal C++ book and learn it through that and then just put what I learn in that together with what I have learn about visual applications?

I know now how to make a visual application using Dev-C++ and ResEd - well I don't know all the code off the top of my head but I know what it means and where to put it so I can put together a visual application in a few minutes.

The problem with me getting a normal c++ book is that would probably work in 'MS-DOS' style all the time so it wouldn't teach me how to control and use visual controls would it?

So I'd definitely need to go for a normal C++ book AND a WinAPI C++ book?



Thanks,
Craig.
 
Last edited:

Una

Una

Associate
Joined
26 Nov 2004
Posts
2,471
Location
Reading / Lake District
I read this thread as if you were a total beginner to C++ by accident. I would say you need a good grasp of pointers/memory allocation before you start to dive into the WINAPI. Its all very well to look at code and understand what its doing but actually writtting it is another thing. The api information is all out there on MSDN.
 
Soldato
OP
Joined
2 May 2004
Posts
19,943
Una said:
I read this thread as if you were a total beginner to C++ by accident. I would say you need a good grasp of pointers/memory allocation before you start to dive into the WINAPI. Its all very well to look at code and understand what its doing but actually writtting it is another thing. The api information is all out there on MSDN.

So would getting a normal C++ book that works in MS-DOS style teach me all about points/memory allocation?

The only thing I can't do when writing a visual application in Dev-C++ is memorize every single last bit of it to write a visual application... mainly because I have only just started playing around with visual stuff.

Una said:
I read this thread as if you were a total beginner to C++ by accident.

I'm quite a bit of a beginner at C++ but I understand a lot of it and learnt quite a lot of 'un-visual' stuff quite quickly because I have done a lot of PHP and some of/a lot of the code is very similar.

Thanks,
Craig.
 
Last edited:

Una

Una

Associate
Joined
26 Nov 2004
Posts
2,471
Location
Reading / Lake District
This is why people are recomending C# because all memory management is done for you. Imo you need to know the differences between allocating on the stack/heap and when to use (Also making sure your programs dont have memory leaks).
You also need to know about concurrency (threads).. to do a GUI application well.
I don't know what you mean about MS-DOS style book...

You must know about pointers, pass by reference because WINAPI uses this.

I came from a Java background so I found pointers/template meta programming the hardest to get my head around.

Its really a lot different from writting php (well syntactically its algol based as well).

You can hack together programs using tutorials and like wise but you really dont understand whats going on. Learning the principles of good object orientated programming is a must also.

I honestly wouldn't know a good book on WINAPI though.
 
Associate
Joined
15 May 2006
Posts
224
It's not exactly the question you asked so I hope I'm not wasting your time but....

Have you thought about using Perl? You can write visual applications using Perl/Tk on Windows as I have done a number of times. They look pretty reasonable, if a little basic, and perform well.

If you use ActiveState's Perl these can then be compiled into a standalone executable that will include all required libraries etc. (provided by the Perl Developers Kit). I'd suggest this approach would be most useful for small applications. Not something I'd personally use for a large application.

Perl isn't nearly as hard and confusing to learn as C++, and using Tk isn't that difficult once you've learnt the concepts involved. I also found it quite quick to develop in and fairly easy to write robust code. O'Reilly do a number of good books on Perl and TK, starting with Learning Perl, going through Programming Perl and then onto Tk etc. All good reading.
 
Soldato
OP
Joined
2 May 2004
Posts
19,943
Una said:
This is why people are recomending C# because all memory management is done for you. Imo you need to know the differences between allocating on the stack/heap and when to use (Also making sure your programs dont have memory leaks).
You also need to know about concurrency (threads).. to do a GUI application well.
I don't know what you mean about MS-DOS style book...

You must know about pointers, pass by reference because WINAPI uses this.

I came from a Java background so I found pointers/template meta programming the hardest to get my head around.

Its really a lot different from writting php (well syntactically its algol based as well).

You can hack together programs using tutorials and like wise but you really dont understand whats going on. Learning the principles of good object orientated programming is a must also.

I honestly wouldn't know a good book on WINAPI though.

MS-Dos style programs as in they open in command prompt and are run in that window rather than in a visual form.

The reason why I want to learn C++ is because a lot of popular programs are coded in it and I'd just like to learn a well known language that can do... anything.

I do kind of understand what's going on in a visual application, I went through a very good tutorial that explained it all.

JIMA said:
It's not exactly the question you asked so I hope I'm not wasting your time but....

Have you thought about using Perl? You can write visual applications using Perl/Tk on Windows as I have done a number of times. They look pretty reasonable, if a little basic, and perform well.

If you use ActiveState's Perl these can then be compiled into a standalone executable that will include all required libraries etc. (provided by the Perl Developers Kit). I'd suggest this approach would be most useful for small applications. Not something I'd personally use for a large application.

Perl isn't nearly as hard and confusing to learn as C++, and using Tk isn't that difficult once you've learnt the concepts involved. I also found it quite quick to develop in and fairly easy to write robust code. O'Reilly do a number of good books on Perl and TK, starting with Learning Perl, going through Programming Perl and then onto Tk etc. All good reading.

Well, the reason I chose C++ is because it's so popular and used by so many (I think the base of Windows is even in C isn't it?).

I didn't know you could do windows applications in perl? I always thought it was an 'online' code (online as in code like PHP).

Craig.
 
Last edited:

Una

Una

Associate
Joined
26 Nov 2004
Posts
2,471
Location
Reading / Lake District
Yeah pretty much all OS's are written in C/C++ unless they are for research.

C++ is a great skill and is still the most used language in the games industry for many reasons.

I can recommend http://www.libsdl.org/index.php as a good api for visual apps if you wish to make them crossplatform.

My first non text game was a pong clone written in C++/SDL and the code is not as complexed as using win32 api. The advantage of SDL is its cross platform also.

However once you got a good understanding of C++ all you really need is MSDN winapi api docs. Obviously you limit your self to the windows platform with this. One way or the other your going to need to be able to understand it, especially if you wish to branch out into unmanaged directx.

The theory is that if a language is Turing Complete it is possible to do anything another language can do. It rarely is like that in practice though, thats why OS's are not written in perl :) You could write an OS in brain**** but it would take a hell of a long time :)

In the end your just compiling it down to machine code.

Gamedev are running a c++ workshop at the moment, its only about 6 weeks in.. so pretty basic stuff. There are a lot of very good programmers on there who will answer your questions as well. Might be of some use to you.

http://www.gamedev.net/community/forums/forum.asp?forum_id=76

PHP is a server side scripting language where perl is a proper programming language. There's a lot of pros and cons of different languages its just picking the right one for the job imo.

I found this the other day as well,

http://www.directtutorial.com/DX9/Basics/dx9-A.htm

It goes through the basics of setting up a window and initialising it.

There is also http://www.flipcode.com/articles/articles_summary.shtml, however thats closed now sadly :(

Perl hides memory management as well, which is fine if you wish to do something basic. Say you wished to write particle engine, with C++/apis you can actaully control every pixel.
 
Last edited:
Associate
Joined
15 May 2006
Posts
224
I find Perl useful for a wide range of tasks. My main use is for writing scripts on a UNIX box. These range from a multi-process SQL query scheduler to controlling SQL scripts to update databases etc.

Perl also has strong string-handling using regular expressions, good file handling and, on UNIX, good multi-process capabilities.

The Tk toolkit can be used by Perl on Windows/X-Windows to create GUI applications. Perl/Tk is well worth a look if you don't mind your GUI's looking a bit different to the Windows standard - which isn't necessarily a bad thing in some cases.

If you need an Object-Oriented language that gives a 100% Windows look and feel without using .Net then C++ would be a good (possibly the best), if quite challenging, approach.

If you need to do other stuff as well as GUI work then I think it's well worth giving Perl a look. I'm certainly glad I did as it's saved me a lot of C-oriented headaches over the past couple of years.
 
Soldato
OP
Joined
2 May 2004
Posts
19,943
Una said:
Yeah pretty much all OS's are written in C/C++ unless they are for research.

C++ is a great skill and is still the most used language in the games industry for many reasons.

I can recommend http://www.libsdl.org/index.php as a good api for visual apps if you wish to make them crossplatform.

My first non text game was a pong clone written in C++/SDL and the code is not as complexed as using win32 api. The advantage of SDL is its cross platform also.

However once you got a good understanding of C++ all you really need is MSDN winapi api docs. Obviously you limit your self to the windows platform with this. One way or the other your going to need to be able to understand it, especially if you wish to branch out into unmanaged directx.

The theory is that if a language is Turing Complete it is possible to do anything another language can do. It rarely is like that in practice though, thats why OS's are not written in perl :) You could write an OS in brain**** but it would take a hell of a long time :)

In the end your just compiling it down to machine code.

Gamedev are running a c++ workshop at the moment, its only about 6 weeks in.. so pretty basic stuff. There are a lot of very good programmers on there who will answer your questions as well. Might be of some use to you.

http://www.gamedev.net/community/forums/forum.asp?forum_id=76

PHP is a server side scripting language where perl is a proper programming language. There's a lot of pros and cons of different languages its just picking the right one for the job imo.

I found this the other day as well,

http://www.directtutorial.com/DX9/Basics/dx9-A.htm

It goes through the basics of setting up a window and initialising it.

There is also http://www.flipcode.com/articles/articles_summary.shtml, however thats closed now sadly :(

Perl hides memory management as well, which is fine if you wish to do something basic. Say you wished to write particle engine, with C++/apis you can actaully control every pixel.

Thanks very much for those links :)

I think I'm going to stick with C++ for now.

Also, even if it is not an API C++ book do you guys think I should still go for some sort of book or follow tutorials even if they are not API?

Thanks,
Craig.
 
Associate
Joined
15 May 2006
Posts
224
I remember using one of Herbert Schildt's books to learn C++ quite a while ago. He's written a fair few on C++ and the one I used seemed good and thorough.

Amazon is doing a special offer with C++: Complete Reference and C++ A Beginners Guide bundled together which might be of interest.
 
Soldato
OP
Joined
2 May 2004
Posts
19,943
yhack said:
This might help
Not a book, but you could Learn C++ in 21 Days
:)

Edit: Download

Cool, thanks :)

JIMA said:
I remember using one of Herbert Schildt's books to learn C++ quite a while ago. He's written a fair few on C++ and the one I used seemed good and thorough.

Amazon is doing a special offer with C++: Complete Reference and C++ A Beginners Guide bundled together which might be of interest.

Ok, will have a look. Thanks :)
 
Back
Top Bottom