C++ Language Syntax:
(1) C++ Language is designed by “Bjarne Stroustrup”.
(2) C++ Language is an object-oriented programming language.
(3) C++ Language gives a high level of control over system resources and memory.
(4) C++ Language is used in Operating systems, embedded systems etc.
(5) For learning C++ Language, first install the editor and compiler. For this refer to this blog “How to Install Code Blocks for C Language on Windows”. After this installation, you will be able to write C++ Language.
(6) For writing C++ Language, the following syntax is mandatory.
- #include <iostream>: It is a header file library that used in Input & Output functions. It is mandatory while writing C++ Language.
- Using namespace std: It can use names for objects & variables from the standard library. It is mandatory while writing C++ Language.
- Int main(): All code execute inside the intmain() function. Syntax is int main() { Code }
- Semicolon “;”: Each line is ended with “;”.
- Cout <<: It is used for print and output.
- return 0: It is used for ending int main() function.
Sample C++ Language code:
#include <iostream> using namespace std; int main() { cout<< “My first C++ Language code!”; return 0; } |
(7) Note: File extension must be “.cpp”.