Page 85 - Modular_V1.1_Flipbook
P. 85

09                      HEADER FILES AND



                                                                           LIBRARY FUNCTIONS













                        Your Aim


                        to learn about:
                                Header Files                               Functions of math.h Header File
                                  Functions of stdlib.h Header File           More Solved Programs




                 As you already know that C++ provides built-in functions. Built-in functions are defined inside
                 the header files. Hence, these functions are also called library functions. C++ provides a number
                 of header files to perform different types of operations like mathematical calculations, character
                 manipulations, input/output and error checking.

                     HEADER FILES

                 A header file can be defined as a collection of predefined functions which you can use to increase
                 your program’s productivity and save your programming time. These header files comes in-built

                 with the C++ compiler. Hence, these are known as standard header files and the functions they
                 contain are called standard library functions. Generally, all the header files in C++ have the .h
                 extension. C++ provides several header files. Some of them are as follow:

                         Header File                                      Description
                   iostream.h                 It provides standard input and standard output functions.

                   conio.h                    It provides functions for console input/output.

                   math.h                     It provides various functions to perform mathematical operations.

                   ctype.h                    It provides functions to handle characters in C++.
                   stdlib.h                   It provides various functions to perform operations like numbers
                                              to text conversion, text to numbers conversion, memory allocation,
                                              random numbers and various other utility functions.

                 To use any library function in your program, respected header file should be included at the beginning
                 of your program code. You can include a header file in your program by using the preprocessor

                 directive #include followed by name of the header file in between the angular brackets:
                 #include <iostream.h>


                                                                                 Header Files and Library Functions  83
   80   81   82   83   84   85   86   87   88   89   90