Monday, May 24, 2010

Why is C++ so difficult to learn?

Every text I've used gives sort of cut/paste examples that are intended to be typed into a compiler verbatim. Yet every single time I do this, there are compiling errors that I don't know how to repair. I understand the code (the very basics, at least), and if I looked at code on paper, I could tell you what the program does, but this compiler issue is really frustrating. Why can't they just pick a standard format and be done with it, why do compilers always get updated with miniscule changes to the previous version? Any suggestions of a no-fail text/compiler combination that would get me started?





Otherwise, is there another language that would be better for me to tackle (assume no prior experience)?





Thanks

Why is C++ so difficult to learn?
First, get a modern compiler. No excuses here. Visual C++ 2005 or gcc/MingW are acceptable.





Visual C++ Express Edition: http://msdn.microsoft.com/vstudio/expres...


and MinGW:


http://www.mingw.org/





Old Borland C++ (Turbo C/Turbo C++) is not acceptable. The changes aren't small, the language underwent a revision in 98/99 and the language has become significantly more powerful.





Then get a decent book that supports modern C++.





http://accu.org/index.php/book_reviews?u...





Most books are unacceptable. They may be out of date, because they reflect C++ from before the 99 revision. They may pay lip service to the changes in modern C++. Many are just wrong (because the authors are incompetent themselves) and others are too superficial.





I could consider C++ Primer by Stanley Lipmann and Accelerated C++ by Koenig to be one of the best choices.





"Otherwise, is there another language that would be better for me to tackle (assume no prior experience)?"





Either Python: http://www.python.org/


or Ruby: http://www.ruby-lang.org/en/





Both are very high level languages with mainstream support and versatile uses. In other words, they aren't dead end languages and they have commercial support.





If you are going to learn C++, it is critical you get a good book from the list I linked to above, and get a modern compiler like Visual C++ or MinGW. The changes from the 1999 revision are immense.
Reply:Java is much more "standardised" and doesn't suffer from all the quirks of C++. Master Java first and the step up (down?) to C++ will be much easier.
Reply:"Nothing is difficult to do if it is possible." If you try hard again and again, i bet you will success.
Reply:Why you ask??? you are telling a dumb thing what to do. If you program a ball to bounce, you must tell it how high, what kind of velocity, where the ground is at, etc... The point im trying to get at is that it is VERY DRY AND FRUSTRATING starting out, but every last little aspect must be thought of or you will get an error. and yes, there are standards, the C language has been around forever. Not to be blunt, but C has had its standards for awhile, its the users job to learn how to follow suit. BTW, microsoft and their big freakin dorky engineers use A LOT OF lines of code. i.e. Win XP has over 50 million flippin' lines of code. They are not going to break that up for a custom purpose.
Reply:i don't know c++. But i know this, i won't give up on anything that i do and the way i think affect the work that i do...so, think positive. it's not hard if you think it isn't. it's just a matter of time before you could master it.
Reply:Though C++ is an advance version of C programming that uses objects. If you have good backgrounds in C programming and a little bit of knowledge about Object-oriented programming, you can easily master the program.
Reply:1. Because C++ is a strict compiler language (and I'm not talking about Borland C++ compiler). The reason for the strictness is because C++ plays with actual physical memories when using pointers, so in order of not allowing the platform from crashing from an application, strict rules have been put in place.





2. Master GCC compiler, it's hard at first but once you get used to it, all other C++ compilers are easier.





3. ASM can be embedded in a C++ code. Read point 1 as ASM doesn't talk to the OS straight, it talks directly to the bus.
Reply:Really depends on the compiler you are using, If you are using something like Visual Sudio, try using their templates for project creation (also dont forget to include the path of you own header files in the project settings), that ways the basic includes are always there. If you use a complier which is Turbo C++ or a Boroland then basically you have to explicitly remember to include basic header files such as iostream for cin and cout.





Maybe you are fogetting the basics such as the difference between


#include "iostream.h" - looks for a file in the included folder.


#include %26lt;iostream.h%26gt; - looks up in the default place.





either ways its fine but I prefer the first choice, personal preference and fail safe as well.





Get your small basics right on how to get your code compiled, always include the header files, eg if you are working on date and time then the required header file etc etc





try writing a small basic program with cin and cout by using iostream, you would realise that (what I really think) you problems are mostly project settings or include related....





Finally - dont give up....





And happy coding....... :)
Reply:Put your efforts and concentration into the work and it won't be difficult
Reply:which version you are using try cc intead of gcc compiler for first, if you are using linux. else use borland c++ compiler downloadable for free for educational purposes, bothe give best results if your code is ok
Reply:You might try looking for a text that includes a compiler on the included cd. Also, it's easy to type those things in wrong. Just about every text will have the code snippets on a cd, so you can copy it and paste it into your editor.

plum

No comments:

Post a Comment