
C++ Programming Language
C++ is a general-purpose programming language that is used to develop cross-platform high-performance applications. It is referred to as a middle-level programming language as it provides combined features of low-level language and high-level language. It was developed by Bjarne Stroustrup, as an extension to the C language. C++ has an advantage over other programming languages like C i.e. it is based on the principles of Object-Oriented Programming(OOPS Concept). Encapsulation. C++ gives programmers a high level of control over system and memory resources.
C++ Features v/s Other Programming Languages
- C++ is a highly powerful and efficient language
- It supports multi-device, multi-platform application development
- It is an object-oriented programming language and has features like classes, inheritance, polymorphism, data abstraction and encapsulation.
- It allows operator overloading, function overloading and exception handling
Writing our first Code in C++
#include<iostream.h>
using namespace std;
int main()
{
cout<<"Hello, World";
}
return 0;
OUTPUT
------
Hello, World
#include<iostream.h>- It is a preprocessor directive that tells the preprocessor to incorporate header files within the program. < > indicate the beginning and end of the file name to be enclosed. iostream is a header file that contains functions for input and output operations.
using namespace std- This statement means that the scope it is present, make all the things under the std namespace available without having to prefix std:: before each of them.
int main()- main() is the entry point C++ program. int is the data type of the main function. It will return integer value as a return.
{ }- Curly Brackets mark the beginning of the main function here. In general, it marks the beginning and end of any function, loops, classes, or conditional statements.
cout – It is used to display a stream of characters. The ‘c’ in cout means “character” and ‘out’ refers to “output”, therefore cout stands for “character output”.
return 0- It means that the main function of the program is executed successfully and 0 is returned to the Operating System.
