INTRODUCTION of C++



                       

            Introduction of  C++



C++ Language FAQ

What is C++?
C++ is a programming language. It literally means "increased C", reflecting its nature as an evolution of the C language.
Is it necessary to already know another programming language before learning C++?
Not necessarily. C++ is a simple and clear language in its expressions. It is true that a piece of code written with C++ may be seen by a stranger of programming a bit more cryptic than some other languages due to the intensive use of special characters ({}[]*&!|...), but once one knows the meaning of such characters it can be even more schematic and clear than other languages that rely more on English words.
Also, the simplification of the input/output interface of C++ in comparison to C and the incorporation of the standard template library in the language, makes the communication and manipulation of data in a program written in C++ as simple as in other languages, without losing the power it offers.
How can I learn C++?
There are many ways. Depending on the time you have and your preferences. The language is taught in many types of academic forms throughout the world, and can also be learnt by oneself with the help of tutorials and books. The documentation section of this Website contains an online tutorial to help you achieve the objective of learning this language.
What is OOP: Object-oriented programming?
It is a programming model that treats programming from a perspective where each component is considered an object, with its own properties and methods, replacing or complementing structured programming paradigm, where the focus was on procedures and parameters.
Is C++ a proprietary language?
No. No one owns the C++ language. Anyone can use the language royalty-free.
What is ANSI-C++?
ANSI-C++ is the name by which the international ANSI/ISO standard for the C++ language is known. But before this standard was published, C++ was already widely used and therefore there is a lot of code out there written in pre-standard C++. Referring to ANSI-C++ explicitly differenciates it from pre-standard C++ code, which is incompatible in some ways.
How may I know if my compiler supports ANSI-C++?
The standard was published in 1998, followed by a revision in 2003. Some compilers older than the standard implement already some of its features, and many newer compilers don't implement all ANSI-C++ features. If you have doubts on whether your compiler will be able to compile ANSI-C++ code, you can try to compile a piece of code with some of the new features introduced mainly after the publication of the standard. For example, the following code fragment uses the bool type, and uses namespaces and templates.
1
2
3
4
5
6
7
8
9
#include <iostream>
using namespace std;
template <class T>
bool ansisupported (T x) { return true; }

int main() {
  if (ansisupported(0)) cout << "ANSI OK";
  return 0;
}
ANSI OK

If your compiler is able to compile this program, you will be able to compile most of the existing ANSI-C++ code.
How can I make windowed programs?
You need a C++ compiler that can link code for your windowing environment (Windows, XWindow, MacOS, ...). Windowed programs do not generally use the console to communicate with the user. They use a set of functions or classes to manipulate windows instead, which are specific to each environment. Anyway the same principles apply both for console and windowed programs, except for communicating with the user.
What is Visual C++? And what does "visual programming" mean?
Visual C++ is the name of a C++ compiler with an integrated environment from Microsoft. It includes special tools that simplify the development of large applications as well as specific libraries that improve productivity. The use of these tools is generally known as visual programming. Other manufacturers also develop these types of tools and libraries, like Borland C++, Visual Age, etc...





 History of C++

The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity to work with was a language called Simula, which as the name implies is a language primarily designed for simulations. The Simula 67 language - which was the variant that Stroustrup worked with - is regarded as the first language to support the object-oriented programming paradigm. Stroustrup found that this paradigm was very useful for software development, however the Simula language was far too slow for practical use.

Shortly thereafter, he began work on "C with Classes", which as the name implies was meant to be a superset of the C language. His goal was to add object-oriented programming into the C language, which was and still is a language well-respected for its portability without sacrificing speed or low-level functionality. His language includedclasses, basic inheritanceinliningdefault function arguments, and strong type checking in addition to all the features of the C language.

The first C with Classes compiler was called Cfront, which was derived from a C compiler called CPre. It was a program designed to translate C with Classes code to ordinary C. A rather interesting point worth noting is that Cfront was written mostly in C with Classes, making it a self-hosting compiler (a compiler that can compile itself). Cfront would later be abandoned in 1993 after it became difficult to integrate new features into it, namely C++exceptions. Nonetheless, Cfront made a huge impact on the implementations of future compilers and on the Unix operating system.

In 1983, the name of the language was changed from C with Classes to C++. The ++ operator in the C language is an operator for incrementing a variable, which gives some insight into how Stroustrup regarded the language. Many new features were added around this time, the most notable of which are virtual functionsfunction overloading, references with the & symbol, the const keyword, and single-line comments using two forward slashes (which is a feature taken from the language BCPL).

In 1985, Stroustrup's reference to the language entitled The C++ Programming Language was published. That same year, C++ was implemented as a comercial product. The language was not officially standardized yet, making the book a very important reference. The language was updated again in 1989 to include protected and static members, as well as inheritance from several classes.

In 1990, The Annotated C++ Reference Manual was released. The same year, Borland's Turbo C++ compiler would be released as a commercial product. Turbo C++ added a plethora of additional libraries which would have a considerable impact on C++'s development. Although Turbo C++'s last stable release was in 2006, the compiler is still widely used.

In 1998, the C++ standards committee published the first international standard for C++ ISO/IEC 14882:1998, which would be informally known as C++98. The Annotated C++ Reference Manual was said to be a large influence in the development of the standard. The Standard Template Library, which began its conceptual development in 1979, was also included. In 2003, the committee responded to multiple problems that were reported with their 1998 standard, and revised it accordingly. The changed language was dubbed C++03.

In 2005, the C++ standards committee released a technical report (dubbed TR1) detailing various features they were planning to add to the latest C++ standard. The new standard was informally dubbed C++0x as it was expected to be released sometime before the end of the first decade. Ironically, however, the new standard would not be released until mid-2011. Several technical reports were released up until then, and some compilers began adding experimental support for the new features.

In mid-2011, the new C++ standard (dubbed C++11) was finished. The Boost library project made a considerable impact on the new standard, and some of the new modules were derived directly from the corresponding Boost libraries. Some of the new features included regular expression support (details on regular expressions may be found here), a comprehensive randomization library, a new C++ time library, atomics support, a standard threading library (which up until 2011 both C and C++ were lacking), a new for loop syntax providing functionality similar to foreach loops in certain other languages, the auto keyword, new container classes, better support for unions and array-initialization lists, and variadic templates.

Written by Albatross.




INTRODUCTION  to  C++ 



                                       C++ (pronounced "cee plus plus") is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features.Developed by Bjarne Stroustrup starting in 1979 at Bell Labs, it adds object oriented features, such as classes, and other enhancements to the C programming language. Originally named C with Classes, the language was renamed C++ in 1983,as a pun involving the increment operator.
                                     C++ is one of the most popular programming languages and is implemented on a wide variety of hardware and operating system platforms. As an efficient compiler to native code, its application domains including systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games.Several groups provide both free and proprietary C++ compiler software, including the GNU Project, Microsoft, Intel and Embarcadero Technologies. C++ has greatly influenced many other popular programming languages, most notably C# and Java. Other successful languages such as Objective-C use a very different syntax and approach to adding classes to C.
                                      C++ is also used for hardware design, where the design is initially described in C++, then analyzed, architecturally constrained, and scheduled to create a register-transfer level hardware description language via high-level synthesis.
The language began as enhancements to C, first adding classes, then virtual functions, operator overloading, multiple inheritance,templates, and exception handling among other features. After years of development, the C++ programming language standard was ratified in 1998 as ISO/IEC 14882:1998. The standard was amended by the 2003 technical corrigendum, ISO/IEC 14882:2003. The current standard extending C++ with new features was ratified and published by ISO in September 2011 as ISO/IEC 14882:2011(informally known as C++11).






Instructions for use by Tutorial way

To whom is this tutorial directed?

This tutorial is for those people who want to learn programming in C++ and do not necessarily have any previous knowledge of other programming languages. Of course any knowledge of other programming languages or any general computer skill can be useful to better understand this tutorial, although it is not essential.

It is also suitable for those who need a little update on the new features the language has acquired from the latest standards.

If you are familiar with the C language, you can take the first three parts of this tutorial as a review of concepts, since they mainly explain the C part of C++. There are slight differences in the C++ syntax for some C features, so I still recommend you to read them.

The 4th part describes object-oriented programming. 

The 5th part mostly describes the new features introduced by ANSI-C++ standard. 


Structure of this tutorial

The tutorial is divided in six main parts, and each part is divided into several sections covering one specific topic each. You can access any section directly from the section index available on the left side bar, or begin the tutorial from any point and follow the links at the bottom of each section.

Many sections include examples that describe the use of the newly acquired knowledge in the chapter. It is recommended to read these examples and to be able to understand each of the code lines that constitute it before passing to the next chapter.

A good way to gain experience with a programming language is by modifying and adding new functionalities on your own to the example programs that you fully understand. Don't be scared to modify the examples provided with this tutorial, that's the way to learn!


Compatibility Notes

The ANSI-C++ standard acceptation as an international standard is relatively recent. It was first published in November 1997, and revised in 2003. Nevertheless, the C++ language exists from a long time before (1980s). Therefore there are many compilers which do not support all the new capabilities included in ANSI-C++, especially those released prior to the publication of the standard.

This tutorial is thought to be followed with modern compilers that support -at least on some degree- ANSI-C++ specifications. I encourage you to get one if yours is not adapted. There are many options, both commercial and free.


Compilers

The examples included in this tutorial are all console programs. That means they use text to communicate with the user and to show their results.

All C++ compilers support the compilation of console programs. Check the user's manual of your compiler for more info on how to compile them.

No comments:

Post a Comment