The function named main is a special function in all C++ programs it is the function called when the program is run. Functions will be discussed in detail in a later chapter, but essentially, their definition is introduced with a succession of a type ( int), a name ( main) and a pair of parentheses ( ()), optionally including parameters. Essentially, a function is a group of code statements which are given a name: in this case, this gives the name "main" to the group of code statements that follow. Line 4: int main () This line initiates the declaration of a function. They simply improve readability of the code. In this case, the directive #include, instructs the preprocessor to include a section of standard C++ code, known as header iostream, that allows to perform standard input and output operations, such as writing the output of this program ( Hello World) to the screen. They are special lines interpreted before the compilation of the program itself begins. Std::cout Lines beginning with a hash sign ( #) are directives read and interpreted by what is known as the preprocessor. my first program in C++ #include int main()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |