Hello friends, in this post today, we will learn about how to write Basic structure of a c++ program. so let's start...
![]() |
Basic structure of c++ |
Structure of c++:-
The general structure of any C++ program is given below. It simply states that a standard C++. program may look like according to various sections presents in the structure.
![]() |
Structure of c++ program |
• The first section Documentation is optional and is used to put comments for the program usually the program heading as we have given.
• In second section we include various header files required by our C++ program.
• Symbolic constants and global variable, functions are defined after that if required.
• The class, main building block of C++ programming is declared which consists of
declaration of data members and functions. The member function may be declared and
defined in the class or they are declared in the class but defined outside the class
which is done outside the class declaration.
• The main() function must be present in every C++ program. It contains all the statements
which are to be executed. Inside this main function we create objects of class created
earlier. All statements are put inside the braces and terminate with semicolon.
The best way to start learning a programming language is by writing a program. Therefore, here is our first c++ program:
I hope that whatever information I have given in this post today, you have liked it and you have understood it.so keep learning and wait for the next post that will help you to increase your knowledge with some new information.
Thank you so much for reading. And take care about yourself and your family.
Nice
ReplyDelete