Coding Beyond Technology..

Tuesday, 5 May 2015

Header files and their in-built functions -1

Header files are pre-coded error free programs which are included before the actual programs are written . They provide  some in-built functions, classes etc which helps us to code , saves our time , make our  programs from being too lengthy and hence decreases compilation/execution  time.

1. iostream.h - header file    

Syntax- #include<iostream.h> ( for Turbo and Borland c++)
             #include<iostream>    ( for DevC++)

"iostream" means input-output stream. The name itself says that this header file includes those in-built functions which perform the input-output operations, i.e, functions that helps to take input from the keyboard , process the input data and display the resulting output to the screen or console.

Note:-
           {   Actually, iostream is an in-built class embeded/or packed in header file called iostream.h. } 
                

One of the most important in-built function that this header file include is an operator overloaded function ">>" and "<<".

a. ">>" - Normally called Bitwise Right Shift Operator, othername Extraction Operator.  It is an operator overloaded member function of the class iostream with an object "cin" (console input) with which you can take any kind and type of input(like numbers, characters, words, lines, paragraphs etc) from your keyboard.

Syntax:-  cin>>INPUT FROM YOUR KEYBOARD;

b. "<<" - Normally called Bitwise Left Shift Operator ,othername Insertion Operator.  It is an operator overloaded member     function of the class iostream with an object "cout" (console output) with which you can take any kind and type output(like number, characters, words, lines, paragraphs etc) to  your console/screen/monitor.

Syntax:-  cout<<"OUTPUT TO YOUR MONITOR";

Note:- { Give output as letters, words, lines, paragraph or any character on screen, you must enclose                 it between Double Inverted Commas ("....") except variables and function calling( will                         discuss later.). }


Readers Please dont be confused about classes and functions, they will be  discuss later. Till then just remember cin>> and cout<< are used for taking input and giving output respectively.




0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Powered by Blogger.