|
Rance Necaise
Visiting Associate Professor of Computer Science |
||
|
|
||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
C++ Primer For Java Programmers The Standard Library« Function Declarations | Table of Contents | Standard IO »
Include DirectiveTo use a module from the standard library, you use the #include <cstdio> #include <cmath> while C++ specific modules are indicated by name alone #include <fstream> The include directive has two forms. The bracket form illustrated above instructs the compiler to search for modules in the system directories only. To include a custom module (or one not located in he system directories), the module name is enclosed within double quotes #include "mymodule.h" #include "graphics/window.h" Modules in C++ consists of two files: a header file and an implementation file.
When a module is included within a program, it is the header file (with a NamespacesThe latest version of the C++ language has defined the use of namespaces which allow for duplication of function and class names within difference namespaces. All of the standard C++ modules use the #include <iostream> int main() { int age; std.cout << "How old are you? "; std.cin >> age; } or explicity tell the compiler you are using the standard namespace with the #include <iostream> using namespace std; int main() { int age; cout << "How old are you? "; cin >> age; } Standard Library ModulesThe following is a list of the standard C library modules included in C++
The following is a list of the standard C++ library modules
|