BASIC STRUCTURE OF PROGRAM IN C++
#include<iostream>
using namespace std;
int main()
{
........................
........code........
........................
return0;
}
§ '#' is a preprocessor that indicates that instructions
for complier.
§ 'include' is a keyword that’s mean to add anything.
§ 'iostream' is a header file.
Header File:
"Files that contain the
Declaration of build in function"
Header files are the build in
files that have some build in instructions or function or meanings of some
build in function or the rules of using those keywords
It also has ".h"
extension.
That files are build by the
programmer or manufacturer of the compiler.
§ "iostream" contains all build in information
about input and output functions that are used in the program by the programmer
or a user of compiler.
§ 'using' is a keyword that specify the directory to
compiler to which directory is used in "iostream".
§ 'namespace' is a name of directory that are being used
by the compiler.
§ 'std' mean standard library of a header file.
Keyword:
Keyword
or reserved words are the words, which have pre-defined meaning in any high
level programming language.
Directory:
A directory is defined as an organizational unit, or container, used to organize folder and files into a hierarchical structure.
A directory contains bookkeeping information about files that are, figuratively speaking, beneath them in the hierarchy. You can think of a directory as a file cabinet that contains folders that contain files.
A directory is defined as an organizational unit, or container, used to organize folder and files into a hierarchical structure.
A directory contains bookkeeping information about files that are, figuratively speaking, beneath them in the hierarchy. You can think of a directory as a file cabinet that contains folders that contain files.
FUNCTION
main ():
·
Main () is a function where the
execution of the program are started. Every program has a main () function.
· It acts like a main gate of a house. Main () is a
starting point of program instructions. It is a entry point of the program.
·
The definition of the main
function is always start with a reserved words (function return type) like
(void, int , float and char) that are also data types.In programming when void is used as a function return type,it indicates that the function does not return any value.
Void:In programming when void is used as a function return type,it indicates that the function does not return any value.
Void as a Function Return Type:
Void functions, also called
non-value-returning functions, are used just like value-returning functions
except void return types do not return a value when the function is executed.
The void function accomplishes its task and then returns control to the caller.
Int
as a Function Return Type:
Int function is a
value-returning function. It returns an integer type value after the execution
of the whole body of the program. In ‘int main () ‘we ask the compiler after
the end of program you return any integer type value.
After the execution of the program lines (statements), we use ‘return’
keyword that is used to return any value to compiler. Return follows any
integer type value.
Delimiters:
After a main () function the instructions are
written in the parenthesis {}. The rest of the lines of program form the body
of the main function, the body is started by the opening parenthesis and end by
the closing parenthesis.
Braces indicate the beginning and end of the
function body. These braces are called delimiters.
Statement
Terminator:
Every statement in a
C++ program terminates with the semicolon (;). If any of the statement missing
the statement terminator, the compiler will report an error.
Comments
Post a Comment