Saturday, March 26, 2011

Lets step on to the amazing C++ world - Part 2 - Environment Contd..

Hello guys, I think now you're comfortable with the basic environment of C++. Today, I'm going to introduce you a new platform to compile C++ programs. That is visual C++ which is a Microsoft's implementation of C++. There are 6 main phases in visual C++.

       1.) Edit - Program is created in the editor and stored on the disk.
       2.) Preprocess -  Preprocessor, processes the code
       3.) Compile - Creates the object code and stores on the disk
       4.) Link - Linker links the object code with the libraries
       5.) Load - Loader puts program in memory
       6.) Execute - CPU takes each instruction and execute it, storing new data values also will happen as it     executes the program.

 Those are the main steps in visual C++. In Microsoft platform, there are two main compiler applications to compile and execute C++ programs. They are Visual C++ 6.0 and Visual The difference between these two is, Visual C++ 6.0 produces an unmanaged code (Direct conversion of High Level Language to Machine Language using a compiler) and Visual produces a managed code (Using intermediate language between the High level language and the machine language.).

To work with this Microsoft's platform, you need to use "Namespaces". All the elements of the standard C++ library are declared within what is called a namespace, the namespace with the name std. In order to access its functionality we declare with this expression that we will be using these entities. std:: specifies using name that belongs to “namespace”. As an example, when you are using insertion operator (which will be discussed in the next lesson), we have to declare std : : cout; . So for library functions, we need to use this. But with a single statement "using namespace std;" we can avoid declaring it everywhere. So,, that's it about basics of the Visual C++ environment. You can use Visual C++ 6.0 or Visual Studio (for .net) to work with C++. But my preference is to work with Turbo C++ which I mentioned in previous lesson.

So... now you are up to speed to be a C++ programmer. Then Let's start with codings and C++ coding basics.