Introduction to cpp with basic program

cpp_learn
2 min readMay 2, 2020

--

cpp programming is majorly used to write advanced application which need to run with high speed.

cpp was first known as c with classes in 1970 and later a standard of cpp which is c++98 came out in 1998.

Let’s start with a basic program to begin with cpp programming.

Here,

#include <iostream> statement includes the iostream library which stands for standard input-output stream. This header defines the standard input/output stream objects which are used for input and output operations.

int main() is the function definition, where int is the return type of the function and main is the function name. The main() function is the function which is triggered by the OS when you run the executable file.

The { and } brackets indicate the beginning and ending of a function. They even indicate the scope which we will see in the upcoming posts.

The std::cout statement is used to print to the output stream which is majorly the console. the cout is a output stream object which is available under std namespace. we will learn about later, and also other way of including namespaces will also be seen.

The insertion operator << is used to insert the value or text on the right side of it into the stream object on the left side of it.

The return 0 statement is to indicate the system that the program has successfully executed and if the program fails system returns -1 or some other value.

— — — — — Further Posts to have more info on cpp programming — — — —

--

--

cpp_learn
0 Followers

Strive to learn. Implementing is the best way to learn. 😃