Input / Output in C++

Preprocessor Directive - 

Used to include files. Ex: #include. There are some files in C++ that are used for a specific purpose. Ex: #include<iostream> is used for taking input and printing output.

The execution of the code begins from the main function. It is mandatory for any program. Ex: int main(). 

"cout" is used to display output that is in quotation marks. Ex: cout<<"Hello World";. It will display the output as Hello World.

return 0 is important to specify. It marks the end of the function. That means now you can get out of the function. So, we can say that it is the exit status of the function.

{}, the curly braces indicate the start and end of a function.

Sample Program:

#include<iostream>
using namespace std;

int main(){
    cout<<"Hello World\n";
    return 0;
}

Output:
Hello World
                                                                  

Comments

Popular posts from this blog

THREE LEVELS OF DATA INDEPENDENCE

Python-HackerRank Problem List Comprehensions

Python Problem Solving - Lonely Integer