how program compile

 write program :- 
 #include <iostream>
 using namespace std;
 int main()
 {
 cout << "Programming is great fun!";
 system("pause");
 return 0;
 }

The output of the program is shown below. This is what appears on the screen when the program runs.
Program Output :
Programming is great fun!
 (if your program is not compile or give error then ask me in comment .,) 
how they work :-
#include <iostream>
 this line starts with a #, it is called a preprocessor directive . The preprocessor reads

your program before it is compiled and only executes those lines beginning with a # symbol.
Think of the preprocessor as a program that “sets up” your source code for the compiler.
The #include directive causes the preprocessor to include the contents of another file in
the program. The word inside the brackets, iostream , is the name of the file that is to be
included. The iostream file contains code that allows a C++ program to display output
on the screen and read input from the keyboard. Because this program uses cout to display
screen output, the iostream file must be included. The contents of the iostream file
are included in the program at the point the #include statement appears. The iostream
file is called a header file, so it should be included at the head, or top, of the program.
using namespace std;
Programs usually contain several items with unique names.C++ uses namespaces to organize the names of program entities.
The statement using namespace std; declares that the program will be accessing entities
whose names are part of the namespace called std . (Yes, even namespaces have names.)
The reason the program needs access to the std namespace is because every name created
by the iostream file is part of that namespace. In order for a program to use the entities
in iostream , it must have access to the std namespace.
int main()
This marks the beginning of a function. A function can be thought of as a group of one or
more programming statements that collectively has a name. The name of this function is
main, and the set of parentheses that follows the name indicate that it is a function. The word int stands for “integer.” It indicates that the function sends an integer value back to
the operating system when it is finished executing.
Although most C++ programs have more than one function, every C++ program must have a
function called main . It is the starting point of the program. If you are ever reading someone
else’s C++ program and want to find where it starts, just look for the function named main .
{
This curly brace is use to execute multiple statements for single function. every statement written in this execute for int main () function.it has also closing curly brace
Case sensitive language
C++ is a case-sensitive language. That means it regards uppercase letters as being
entirely different characters than their lowercase counterparts. In C++, the name of the
function main must be written in all lowercase letters. C++ doesn’t see “Main” the same
as “main,” or “INT” the same as “int.” This is true for all the C++ key words.
cout << "Programming is great fun!";
To put it simply, this line displays a message on the screen. The message “Programming is great fun!” printed without the quotation marks. In programming terms, the group of characters inside
the quotation marks is called a string literal or string constant. This is the only line in the program that causes anything to be printed on the
screen. The other lines, like #include <iostream> and int main() , are necessary for
the framework of your program, but they do not cause any screen output. Remember,
a program is a set of instructions for the computer. If something is to be displayed on
the screen, you must use a programming statement for that purpose.
At the end of the line is a semicolon. Just as a period marks the end of a sentence, a semicolon
marks the end of a complete statement in C++.
system("pause");
This statement is used to hold your program output.
when you insert this statement . your program is paused and ask you for "press any key to continue" 
return 0;
This sends the integer value 0 back to the operating system upon the program’s completion.
The value 0 usually indicates that a program executed successfully.
we will discuss all of these in more detail in next tutorials.