When I studied C++ ,all the first chapters were too much boring since they contain only THEORY

to help you understand what a Program is and the basic GRAMMAR (Syntax) to be followed while writing these.

But I shall take you guys Directly to a C ++ Code.

As it is formal, Let me give you the definition of what a program is in my own language;

Program Or Code snippets are User written instructions in a specific computer eligible manner

which make the Computer perform more specific and useful action in favor of the User or Programmer.!!

Oh God I’m Boring you with theory right.?

That’s it!!   I’m done! Let’s go Practical (0.O)

I hope you all have Installed C++ in your machine.

If not read this post.

Now lets Code!

Look into this Image

1main Program
This is a Basic Program.

Now  I shall tell you what these Characters will mean to you right from this moment.

main Program

Now Lets go

Header Files :All you have to understand about a header file is that it is a “Software File” which you can even modify!!!! 

Its is a file which contains “Function Definitions”.

Now comes the word Function.

What is a function? It is a set of program codes which when executed gives needed results.

So we can say that C++ is a big function which executes minor functions inside.

In this program functions used are: clrscr() and getch(). 

Then what is a “main()”

It is also a function!!!

(In order to find the order of execution you can press F7 and can see the path followed while the code is executed.)

By Observing the order ,we see that the execution starts from the main()

Yes you guessed it right! Execution starts right from the main function!! (Please note this point).

Now let me tell that iostream.h and conio.h are not only the header files you can use!

You can even create your own header file!!

#include <header name> is a way in which you can paste a header file directly into the current file( i.e. Your Code) .

We will go deeper into it later!

Now there is a Question;

Why did I just use these two header files?

It is because I only needed them to run the program correctly.

iostream.h is a very useful header files with very commonly used functions and objects.

You can look for what an Object is in  OOP (Object Oriented Programming).

“cout” is an object of a class in iostream.h .

In order to print “HelloWorld” ,You have to give as given in the snippet.

As You can also try to print your name. Try replacing “HelloWorld” with your name.

conio.h is another header file in which both the functions clrscr() and getch() are defined.

Using braces{} we open and close a function definition.( i.e. main() function definition is what given between the braces).

Pres ALT+F9 to run the program.

Dont forget that each line command end is denoted by a semicolon(;).

Just as we use a full stop in a sentence.

I will show you the output.


Now, Lets code!

Comment in any queries.

Go on!!! try Clicking everywhere to find anything……..

Trust me, it’s how I learned about functions that ware not seen in the text book.

Tip: Right click to see C++ Help

         Type in any word you want to know about.

         Click on it!!!!!