header files of c++ unit 3 -topic 3
TRANSCRIPT
Header Files of C++Header files contain definitions of Functions and Variables, which is imported or used into any C++ program by using the pre-processor #include statement. Header file have an extension ".h" which contains C++ function declaration and macro definition.
Why need of header filesWhen we want to use any function in our C++ program then first we need to import their definition from C++
library, for importing their declaration and definition we need to include header file in program by using
#include.
Stdio.hInput and Output operations can also be performed in C++ using the C Standard Input and Output Library (cstdio, known as stdio.h in the C language). When you include iostream.h file in your program ,this file i.e, stdio.h automatically gets included in your program.
<iostream.h>
• Standard Input / Output Streams Library.• Cin Standard input stream (object ) • Cout Standard output stream (object )
<conio.h>• conio.h header used in c programming contains
functions for console input/output.• console is a term used for the black window, which
is also called as command prompt.• Some of the most commonly used functions of
conio.h are clrscr, getch,etc.
<iomanip.h>• This file declares services useful for performing
formatted I/O with so-called parameterized stream manipulators, such as setw and setprecision.
• setprecision -Sets the decimal precision to be used to format floating-point values on output operations.
• Setw- Sets the field width to be used on output operations.
• The operator used for taking the input is known as the extraction or get from operator (>>), while the operator used for displaying the output is known as the insertion or put to operator (<<).
Example of setprecision
Example of setw
Stringh.h
<math.h>• Most of the mathematical functions are
defined in math.h ( cmath header in C++).• The functions that operate on integers, such
as abs , labs , div , and ldiv , are instead defined in the stdlib.h header ( cstdlib header in C++).
<stdlib.h>• This header defines several general purpose
functions, including dynamic memory management, random number generation, communication with the environment, integer arithmetics, searching, sorting and converting.
rand