My first experience with programming code in C++...
Guys as I promised
in my last blog that I am going to share my experiences and codes that I learned
in C++ programming language.
I am using
visual studio code for ide as it is Microsoft free platform and having a good user
interface.
My first
code on “hello world.” that felt that I am champion in programming and
that would be a great start in my journey. There is a great psychology that
before doing any work there is a need of mindset that helps you to go further.
And this program really gives me a deep confidence and interest in programming
language.
Here I used
“hello viewers.” Instead to “hello world.” for dedicating to my
viewers.
This is the
screenshot of my first successful code and its output. But on that I really
confused a lot too. As I don’t know about <iostream>, what is this,
std, cout and many things. I searched it on google and then I understand
what is this all about.
In programming
languages there are so many libraries, in which there are some functions, files
that are used for programming to make it easy use of language. One such library
is “iostream”, the most basic work of this library that we used in our program
is input-output the data. #include is the way of adding the file “iostream”.
In the next
line that is empty is nothing but just left empty to see clearly the code,
blank lines are not considered by compiler so it is on us how much lines we left
blank.
In the third
line, we first we write int, it is a datatype that is used for integers, after
that main() is a function that is used to do some set of work, here () shows
that main is function, { this indicates the starting body of the function, }
this is the closing of body and between these curly braces, we have to write
the body of function that is going to work by the function. If you want to take
an analogy of function in real life, is restaurant, just you go to restaurant,
you gave the order to someone, let name the waiter be Annie, Annie forwards
this order to the chef to so that he cook the food that you ordered, let name
the chef be Jon. Here Annie has a function of taking orders, Jon has a function
of cooking the food.
Now takes 4th
line, here “std” is a namespace, ‘::’ scope resolution operator
and “cout<<” is the function used to output data on the screen, “hello
viewers.” is a string that is written between “ ” and “;” is
used to end the line.
In the fifth
line, “return 0” is a returning 0 by the function main(),
that shows a successful compilation of code.
These all are the basic requirements in the code, explained in informal language, comment in comment box if I want to add proper definition in the blog.
This is all
about in this code. I will come tomorrow with the new code.
Please comment, how you like my blog and share your experience too.

Comments
Post a Comment