Saturday, November 24, 2018

Structure of a C++ Program and IDE



In this article, we are going to cover: Program files system of C++, Structure of a C++ program and something about C++ IDE.
So, let’s move ahead…


1. Program files system of C++


- Basically, when we write code, the code is saved in a “title.cpp” file; the object code (binary code)    is stored in “title.o” file, and the application file is a “title.exe”. This all files and the arrangement    of these files in directories is C++ program files system.
- So, let’s learn the process of creating these files. The code we write is called as Source code, it is       written in a “title.cpp” file called Source code file. When we successfully compile source code, a     “title.o” file is generated which has all the binary code of our program and some references to the   external files associated with our program (like graphics libraries files) and this file is called Object   Code file. Concurrently a “title.exe” file is created which is nothing but our main executable file.

                                 

 That’s it.

2. Structure of a C++ program


- Every programming language has its own program structure; likewise, C++ also has a program     structure.
- A program structure is nothing but a Skelton, which all the codes of that particular language  follow. It specifies the way and area to do the correct stuff on the correct place (stuff like external files inclusion, variable declaration and etc.).
- So here is the structure of C++ program, a C++ program is divided into following sections:


Header File Declaration Section:

-In this section, we include the required header files for the program. Header files are nothing but the files which contain implementations of all the functions and the macros which we use in the program.

-also in this section, we declare macros, macros are nothing but constants which represent something statement or value. 

These codes are just for example, no need to understand. We will learn them ahead.

-we will understand both the things practically in next the article with code.

Global Declaration Section:


-this section has a lot of stuff, like the declaration of global variables, declaration and, definition of functions etc.

Class Declaration and method definition section:


-in this section we declare all the classes being used in the program and implement them by defining all the member function of each class.


Main Program section:


 - This section contains our main function. The Main function is the entry point for any C++ program.
- In the main function, we declare objects, variables, do calling other function. In short, all our program logic is in the main function.


3. C++ IDE


- To build a C++ application, we need following things: Text Editor to write Code, Compiler to compile code, Linker to link files, Debugger to debug the program and many more things. If we use them separately, it’s going to take much time of us. While developing software, we repeatedly need to test code by executing it. So it will consume a lot of our time to go through this applications separately.
-here IDE comes to rescue. IDE stands for Integrated Development Environment. It integrates text editor, compiler, debugger, and others all in a single software package, and make it easy for us to compile and run the program with just one-click. This is what an IDE is.
-C++ has a lot of IDE’s in the market, of which Visual Studio C++ is most famous and used for developing huge programs in Windows.
-Code::Blocks is a Cross-platform IDE and light and efficient too. For small-scale programming and practice, DevC++ is also a good choice.

-There are many more IDE available in the market for every platform (even Android like CppDroid) and there are Online IDE’s also (like C++ Shell). You can search for them, and choose as per  your choice. I personally recommend and use Code::Blocks.
                      

- I will request you guys to install an IDE in your device so you can practice as we go ahead. One cannot learn programming without practice.


So this much for this article, we are going to do Code in next article, Coding a "Hello World" Program in C++.

----------------------------------------------------------------------------
Below are some links given for you to download IDE's :

Download Sololearn and Programming with fun on Mobile on the way:


----------------------------------------------------------------------------

if any doubt or feedback please feel free to contact : 
    rahulrb15899@gmail.com
    +91 7775919753  (WhatsApp)

No comments:

Post a Comment

C++ Variables and Constants

Many times, we need to store some data in our program. How to accompany this? So, Hello guys, Welcome to this article. In this arti...