Detailed Analysis of Very basic Program in C++ [Hello World]

Mohd Mujtaba
2 min readDec 9, 2020

Hi readers,

This is my very first writing on Medium so I thought let’s start it as I am starting programming in C++

In this writing I’ll give brief explanation of very basic program in C++ which is Hello World, So let’s get started 👺

#include<iostream>
using namespace std;
int main(){
cout<<”HELLO WORLD”;
}

Let’s decode it.
In line #include<iostream>
#
is known as preprocessor directives. This basically tells the compiler that this line will be run before compiling the code
include<> this line tells the compiler to include the package(source code) written in <>

using namespace std -> A namespace is designed to overcome this difficulty and is used as additional information to differentiate similar functions, classes, variables etc. with the same name available in different libraries. Using namespace, you can define the context in which names are defined. In essence, a namespace defines a scope.

int main() -> This (is a function which takes no parameter and return type is integer) tells the compiler to begin execution of program and this main function is required to include in all the file which is supposed to be executed it return a zero or null value once the program exits

cout<< This is standard output operator which prints on the console and it also can be overridden by << operator
e.g cout<<”hello”<<”world”;
This above code will print
hello world in the console

General Information
->
All function in C++ starts with { and ends with }
-> At the end of every line semicolon is required you might have seen many memes on this

Thanks for reading
If I get positive responses that I’ll continue my writings and will be covering usefuls topics like Python,Django,DRF,GraphQL, stuffs related to AWS etc,

Follow me on linkedIn https://linkedin.com/in/mohdmujtaba

--

--

Mohd Mujtaba

SDE-2 @ Wealthy.in | Built systems from scratch | Exploring new Technology