# Learning c++ text makes my brain die

1. Jun 30, 2009

### Rhine720

I've been working on learning c++ pre-emptive to going to college. I've found that I've come to learn it really well off of youtube videos. Unfortunatly there is no youtube series spanning the variety of fields in c++ that i need to learn.

I read too fast and find myself reading right into things that i have no idea how they got there. I quickly find myself lost and confused. I've been reading c++ for dummies. For the most part I've gained some useful knowledge.

Anyway, Does anyone know of any decent c++ video lessons/tutorials that covers things such as function arguments,arrarys..ectect.?

Thanks!

2. Jun 30, 2009

### ranger

I doubt I can give you anything on youtube that you haven't already seen. But you can also check MIT OCW or UC Berkeley webcast for C++ videos.

I would recommend C++ Primer Plus by Stephen Prata. Its an excellent read.

3. Jun 30, 2009

### rootX

Other than ranger recommendations, I would suggest you not to read the book but solve simple problems (developing simple programs in c++ starting from hello world) and refer to the book as you go. If you cannot find good simple problems, refer to the c++ book for the problems.

4. Jul 1, 2009

### AUMathTutor

Just go to the library and get a nice, big, thick book with a name like "the C++ bible for masochists".

Then slowly read through the book. Whenever they introduce a new idea, write some code and compile. It can do anything. Read actively.

When they introduce variables, write a program that defines one of each kind of variable. Assign the variables values. Initialize them.

When you get to arrays, define some arrays. Initialize them. Set elements.

See what I'm saying? Active participation as you're reading... not just reading for ideas... will make it so much easier. Get a good IDE for doing this. I can recommend Microsoft Visual Studio C++ Express Edition.

5. Jul 3, 2009

### Sypher

Hey Man.

I know that feeling of reading to fast. I'ts because of **** tutorials that it happens.
Anyway I don't know of any good video lessons but I used this one from this Herbert dude http://msdn.microsoft.com/en-us/beginner/cc305129.aspx its great.

Happy coding dude!

6. Jul 13, 2009

### MattPD

Rhine, I found these lectures from Stanford to be pretty good:

Programming Abstractions (CS106B)

As for the short (and good) book, I'd definitely recommend "Accelerated C++" -- http://www.acceleratedcpp.com/

Best of luck!

7. Jul 13, 2009

### Rhine720

Thanks to everyone who has replied here. You sources are deffinatly more efficient then what I've been trying to use. I'm going to look at those links MattPD..Thanks!

8. Jul 14, 2009

### Staff: Mentor

I also recommend "Accelerated C++." It uses a "modern" approach to teaching C++ that takes full advantage of the many useful features of the standard library (strings, vectors, etc.), as opposed to many other books which are basically warmed-over C books with the C++-specific stuff spliced in as an afterthought.

9. Jul 17, 2009

### ibcnunabit

I think it would be a lot more fun--and yes, productive--to start learning Python, which is a powerful, super-useful, fairly "clean" language, does its own garbage collection, a good way to learn the concepts, it's everywhere, and a whole lot less painful to use properly. Best of all, learning it'll go faster, which will help you get the CONCEPTS down, which is the most important thing where you're at, (IMO). Then it'll be a lot easier to translate those concepts over to C++. Ruby would be another great choice. You're going to have to learn a lot of languages anyway, and I recommend those two prior to taking university courses. My personal favorite language is Scheme, but that would probably ruin you from ever wanting to be a C++ programmer. ;)

But not trying to start a contentious language discussion or anything. Just my $0.02. --Mike from Shreveport 10. Jul 19, 2009 ### Rhine720 I'm$0.02 richer then ibcnunabit =]

I am LOVING Accelerated c++

The only thing i dislike is the whole return 0;
and std:: cout

Are those important things I should adopt? Man programmers that I do know usually do a simple cout without stating the function library(std)

Also

After every input i use cin.ignore();

and before I end the program instead of return 0;

I use cin.get();

The reason is mainly because I'm using bloodshed,but is my current practices okay if i were in a professional programming situation?

11. Jul 20, 2009

### Sypher

To eliminate the need to type the "std::cout", rather add this statement "using namespace std;" in the declaration area somewhere below the include statements.
Then c++ will asume everything is an std.

I think the "return 0;" statement is necessary to clean up the memory but I am not sure.

And what ibcnunabit/Mike from Shreveport said is very correct. Python would have been a better language to learn early(This said asuming that c++ is your first languge). I also had c++ as my first and was quit a strugle but I am now proud to say I am now an extreme pythonist ;-)

Wel then good luck and happy coding 4 u!

12. Jul 20, 2009

### MattPD

Hi!

Regarding the questions:

(a) int main() { return 0; } -- yes, this is very important; for a few-mins.-long explanation, see e.g. a lecture (by Richard Buckland, UNSW):

// more precisely, just 30:40-37:00, answering to "Can you use void main()?" ;-)

(b) Bloodshed Dev-C++ -- it is a bit outdated -- it has not been under development since 4 years ago; consider switching to something more up-to-date instead, like Code::Blocks:
http://en.wikipedia.org/wiki/Code::Blocks

Instead of playing w/ std::cin.get(), etc., it might be easier just to run the app from the console/shell window :-)

(c) namespaces -- see http://www.devx.com/tips/Tip/12534

Personally, I prefer using declaration (e.g. using std::cout) rather than using directive (like using namespace std;) -- that way, I am always sure which keywords are in the scope and I avoid "polluting" it.

Note, however, that in libraries (header files thereof) which are intended for production use it's best not to use using directives nor declarations at all (or as little as possible), always using fully qualified names instead -- precisely in order to avoid namespace pollution (e.g. you might have two teams of developers working on the modules of a multimedia library, say Video Team and Music Team -- there might be functions like Music::Load() and Video::Load() -- neither of the teams would be very happy if one of the others decided to shove its own "Load" down everyone's throat, right?).

Hence, besides making larger code easier to read (helping one to know where all of the names are coming from), it's a good practice to get used to fully qualified names, as sometimes they're really necessary.

In "Accelerated C++" there is more on that topic -- see 4.3/67 (and later also 9.2).

Hope that helps!

Last edited by a moderator: Sep 25, 2014
13. Jul 20, 2009

### junglebeast

The main function must have integer return type.

However, it is redundant in C++ to actually type "return 0;" this will be assumed if you simply do not write it.

Secondly, EXIT_FAILURE and EXIT_SUCCESS are defined in cstdlib, and these can be more intuitive than having to remember if 0 or 1 is success or failure.

14. Jul 21, 2009