Learning C++ programming can be simplified into:
- Writing your program in a text-editor and saving it with correct extension(.CPP, .C, .CP)
- Compiling your program using a compiler or online IDE
The “Hello World!” program is the first step towards learning any programming language and also one of the simplest program you will learn. All you have to do is display the message “Hello World!” on the screen. Then let’s get started.
Here, #include<iostream> is header file that contains standard input output library functions.
A namespace is a form of scope in C++ that holds its own definitions for variables, functions,.. etc. For example, both cout and cin , along with some useful tokens like endl , are defined inside of std for use.
cout<< is used to print somthing in output console. And the the execution is started from main() method. In C++ return type of main() method is int so at the end of the method we have to return the integer value so we put return 0;
Like C Language every statement of code must ended with semicolon (;).
#include<iostream> using namespace std; //execution started from main() method int main() { cout<<"Hello World!"; return 0; }
OutPut
Hello World!