CS 150 Introduction to C++ Programming - Spring 1998 

[ Home | Lecture Notes| WebTutor | WebTutor Site Map]


Including Functions from Libraries


Many useful functions have been written and placed in standard libraries for your convenience. These functions perform a variety of frequently used computations which woudl be a pain to have to program over and over again (not to mention the possibility of making a mistake in typing it in). Page 103 in the textbook lists several of the more popular libraries (also see Appendix A). To use a library, you need to include its header file (by convention, header files end in ".h"). Almost every C++ program has the standard IO library and thus contains the statement.

#include <iostream.h>

Identify which header files must be included for the following functions (from exercise 5 page 126).

  iostream.h math.h stdlib.h fstream.h iomanip.h
cout << x;
n = abs(difference);
y = sqrt(7.6+x);
cout << y << endl;
cout << setw(5) << n;
Choose one when done
   

Copyright chris wild 1998.
For problems or questions regarding this web contact [Dr. Wild (e-mail:wild@cs.odu.edu].
Last updated: February 03, 1998.