So lets start our programming journey from this lesson. I'll not go into the history of languages, but if you are interested, you can use google.
Today we'll see our first C++ program to get familiar of basics of compiler and C++ syntax. We'll use an open source C++ compiler "Dev C++". You can download it from , Its completely free. Now first have a look at the following program, then I'll explain it for you.
The first line of our code consists off "#include". This is a preprocessor directive. #include isn't the C++ statement, but its an instruction for the compiler. It asks compiler to include the content of the file mentioned in "<>". So when compiler compiles the code, it also includes the contents of the "iostream.h" file. IOStream.h is a header file saved in installation directory of compiler. It a library file having definition of Input and Output streams. It means that if we write or output something on the computer screen, or take or read input from the keyboard, we'll use this file. Because the functions that write on the screen or read from the keyboard are defined in this file.
The second line is main(). main is special function in C++. C++ program start executing from this point. Its the first step or first stair of our program. {} are called body of the main function. (We'll discuss functions later in detail).

No comments:
Post a Comment