CS 161 Introduction to Programming and Problem Solving Chapter 15 C++ Standard Library Herbert G. Mayer, PSU Status 9/8/2014 Initial content copied verbatim from ECE 103 material by prof. Phillip Wong @ PSU
C Standard Library C++ provides standard functions by using external code libraries Before using a library function, its header file must be included (e.g., #include <math.h>) Once a header file is included, all of the definitions, functions, and macros in that library become available to your C source 1
Header Name Std Description (Std: Blank=1989/1990 Standard, NA1=Normative Addendum 1, C99=1999 Standard) Header Name Std Description <assert.h> Contains assert macro for program debugging (do a “man assert” lower case in unix!) <complex.h> C99 For manipulating complex numbers <ctype.h> For character type conversion, upper/lowercase conversion <errno.h> Constants defining error codes <fenv.h> For controlling floating-point environment <float.h> Constants defining Implementation-specific properties of floating-point types <inttypes.h> For conversion between integer types <iso646.h> NA1 For operations involving ISO 646 character sets <limits.h> Constants defining Implementation-specific properties of integer types <locale.h> Location constants <math.h> Contains common mathematics functions <setjmp.h> Contains setjmp and longjmp macros for non-local exits
Header Name Std Description (Std: Blank=1989/1990 Standard, NA1=Normative Addendum 1, C99=1999 Standard) Header Name Std Description <signal.h> For controlling exceptions <stdarg.h> For handling functions with varying number of arguments <stdbool.h> C99 For accessing boolean data type <stdint.h> For defining various integer data types <stddef.h> Contains various definitions and macros <stdio.h> Contains console I/O and file I/O functions <stdlib.h> Misc (e.g., conversion, random numbers, dynamic memory) <string.h> For manipulating strings <tgmath.h> Contains type-generic mathematics functions <time.h> For converting time and date formats <wchar.h> NA1 For manipulating wide characters (e.g., Unicode) <wctype.h> For classifying wide characters 3
Online Resource Searchable online C /C++ library reference: http://www.cplusplus.com/reference/clibrary 4