C++ (pronounced C Plus Plus) is a general purpose middle level programming language. It is called middle level language because it comprises features of both high level and low level language.
Developed by Bjarne Stroustrup at Bells Lab in 1979. It added Object Oriented Features such as classes and objects. It was originally named C with classes, the language was renamed in 1983.
Structure of a program
Developed by Bjarne Stroustrup at Bells Lab in 1979. It added Object Oriented Features such as classes and objects. It was originally named C with classes, the language was renamed in 1983.
Structure of a program
The first line started with # (hash) but in c++ point of view it is called as a preprocessor or a directive. After That we have written include that simply means something going to be attached. After that there is a triangular bracket <>, this is used to attache header files. We have written the name of the header file iostream (input output stream) after that the extension of the header file .h and then bracket is closed. It includes the declarations of basic standard input output library in c++, and it is included because further in program we will use those functions. We included an another header file conio.h (console input output).
Then comes:
void
Void is a data type.
Void is empty data type.
Something which returns null.
main()
A function from where the program starts.() is the syntax of the function. Every function should have the () sign as a postfix because it is the function declaration.
Curly Braces { }
Between these braces the main body of the program is written.
clrscr();
A function defined under conio.h header file which clears the output screen. Semi colon (;) is like a full stop used to end the statement. Every statement ends with a semi colon.
cout
Echo function which prints the output on the screen or Display function used to display output on the output screen.
<<
It is a operator (symbol which identifies what kind of operation or activity going to be performed).
It is called
Bitwise operator,
Left shift operator and
Insertion operator.
getch()
It reads a single character from keyboard and save that without echoing. Usually used as function to stops the output screen so that we can see the output.
Now end of the program by closing curly bracket.
Output
Share if you liked this Post using your favorite sharing service:
Subscribe Updates, Its FREE!
0 comments:
Post a Comment