Using Header Files
Header files are text files containing declarations and
macros. By using an #include directive these
declarations and macros can be made available to any other source file, even in
other header files.
Pay attention to the following points when using header files:
-
header files should generally be included at the start of a program before any other declarations
-
you can only name one header file per #include directive
-
the file name must be enclosed in angled brackets < ... > or double quotes " ... ".
Searching for Header Files
The header files that accompany your compiler will tend to
be stored in a folder of their own—normally called include. If the name of the header file is enclosed by angled
brackets < ... >, it is common to search for
header files in the include folder only. The current
directory is not searched to increase the speed when searching for header
files.
C++ programmers commonly write their own header files and store
them in the current project folder. To enable the compiler to find these header
files, the #include directive must state the name of
the header files in double quotes.
Example:
#include "project.h"
The compiler will then also search the current folder. The
file suffix .h is normally used for user-defined header
files.
Standard Class Definitions
In addition to standard function prototypes, the header
files also contain standard class definitions. When a header file is included,
the classes defined and any objects declared in the file are available to the
program.
Example:
#include <iostream> using namespace std;
Following these directives, the classes istream and ostream can be used with
the cin and cout streams.
cin is an object of the istream class and cout an object of
the ostream class.
1 Comments
seiko titanium - Titanium Art
ReplyDeleteseiko titanium - Titanium Art. $3.75 titanium alloy nier replicant Buy online for 제이티엠허브출장안마 shipping. $3.75. Quantity:. Add titanium blue to Cart. See more titanium nitride coating service near me product info. 4x8 sheet metal prices near me