Whats the difference between C,C+, and C++? are C and C+ lower versions of C++?
monkpart9, I learned a great deal about C++, and to a lesser degree C in college. Just to give a quick synopsis:
C - A procedure-oriented language which originated in the early 1970's used primarily in system programming, including implementing operating systems (very closely tied to UNIX for example). As a widely accepted language because of it's portability and efficiency, the compilers, libraries, and interpreters of other higher-level languages are often implemented in C.
C+ - Never heard of it, I am not sure this even exists, so I have nothing to say about it.
C++ - The language was designed as an enhancement to C, but is alot more than just C with a few new things. The key purpose of allowing for object-oriented programming previously unavailable in C. What is object-oriented programming you ask? Well, many things, but at the heart of it is the "object" like built-in data types: i.e. integer, floating point number, character, (these are pre-defined types; int, float, and char in C++) and state of the object: NULL (empty) or has a value (x = 5) as a few simple examples. A way to think about and remember exactly what object-oriented programming is about can be summed up by the following analogy: an object-oriented carpenter would be mostly concerned with the chair he was building, and secondly about the actual tools used to make it; someone who was a non-object-oriented carpenter would probably think primarily of his tools to build the chair.
You have the flexibility to create your own data types (objects) known as classes. With classes in C++ you can separate a program's interface from the implementation, as well as hiding the internal details of the implementation. The premise is that no one really should need to see HOW what you used implement as certain solution, they just need to know it does what they want so they can use it. For example, I had a programming assignment called "BigFloat" where we had to define a class
, a numeric class similar to the built-in data types float and double, representing positive and negative numbers with at least 300 decimal places of accuracy. None of the C++ built in types allow for this much precision, hence our challenge to define it ourselves. A good example of what we had to do can be seen by looking at this BigInt program, which we used as an example and essentially does the same things our program had to, but main difference is BigInt allows for very larg positive and negative integers (whole numbers) and our program allowed for very large floating point/decimal numbers. Take a look at the BigInt Program here: http://www.emunix.emich.edu/~evett/DataStr...gFloat/bigint.h
(header file) and http://www.emunix.emich.edu/~evett/DataStr...loat/bigint.cpp
(source file or implementation file).
Although C++ offers alot of advantages over C and other languages, it also has some severe disadvantages as well:
1) C++ is far from a perfect language. It can be very challenging to learn and use, even for advanced programmers.
2) C++ is also not a very stable language, meaning the various compilers can tend to behave differently at times (platform portability concept mentioned above).
Don't be discouraged though, keep at it if you really want to learn it. That is all for now, good luck and I hope this helps.
Edited by Lathrup_Baseball, 03 August 2007 - 03:53 PM.