// you’re reading...

Introduction to C++

Introduction to Header Files

The libraries are

  • (Also) called header files
    • And, as computer files
  • They have the extension “.h
    • house.h
    • person.h
    • They could have any name



iostream

  • Asks the computer to display stuff on the monitor’s screen



How to put a library in your program

  • Put it at the beginning of the file (A-1)



Example of (A-1)

iostream.h



How to use a library in your program

  • Simply include it by using the word “include” before the name of the library (A-2)



Example of (A-2)

include iostream.h



The pound sign “#

  • Append the sign when you want the computer to “know” that the word “include” means , “I want to include the following library” (A-3)


 
Example of (A-3)

#include iostream.h



There are usually two kinds of libraries or files you will use in your programs

  • Libraries that came with C++
  • Those that you write



To include your own library

  • Enclose it between double quotes (A-4)



Example of (A-4)

#include "books.h"



To include the library that came with C++

  • Enclose it between < and > (A-5)



Example of (A-5)

#include <iostream.h>



You can add as many libraries

  • As you see fit


Discussion

No comments for “Introduction to Header Files”

Post a comment