Header Files

All functions and variables in C++ need to be declared before they can be used. C++ provides operators, constants, and a few basic types—and that's that. So where are functions like sin() declared? Where does the string type come from? These declarations are in the standard header files. You have not needed to know this because UnderC includes the chief header files automatically. In your project directory, take a look at a file called defs.h, which usually contains these statements:

#include <iostream>
#include <fstream>
#include <stringstream>
#include <string>
#include <vector>
#include <list>
#include <map>
using namespace std;

The #include statements don't look like usual C++ statements, and in fact they are more like UnderC ...

Get C++ By Example: UnderC Learning Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.