A summary of common header files and functions in C + +

Source: Internet
Author: User
Tags bit set mathematical functions natural log set time time and date uppercase letter

A list of header files for C + +

C

#include <assert.h>//Set insertion point
#include <ctype.h>//character processing
#include <errno.h> Define error code
#include <float.h>//floating point processing
#include <iso646.h>        //Macros for various operators
#include <limits.h>//define constants for the most values of various data types
#include <locale.h>//define localized C functions
#include <math.h>//Defining mathematical Functions
#include <setjmp.h>       //exception handling Support
# Include <signal.h>       //signaling mechanism support
#include <stdarg.h>        //indefinite parameter list support
#include <stddef.h>        //Common constants
#include <stdio.h>//define input/output functions
#include <stdlib.h>//define miscellaneous functions and memory allocation functions
#include < string.h>//String handling
#include <time.h>//defining functions on time
#include <wchar.h>//wide character processing and input/output
#inclu De <wctype.h>//wide character category

Traditional C + +

#include <fstream.h>//switch to <fstream>
#include <iomanip.h>//switch to <iomainip>
#include <iostream.h>//switch to <iostream>
#include <strstrea.h>//This class is no longer supported, instead use the StringStream in <sstream>

————————————————————————————————

Standard C + +

#include <algorithm>//stl General algorithm
#include <bitset>//stl bit set container
#include <cctype>//character processing
#include <cerrno>//define error codes
#include <cfloat>//floating-point processing
#include <ciso646>//macros corresponding to various operators
#include <climits>//define constants for the most values of various data types
#include <clocale>//define localization functions
#include <cmath>//defining mathematical functions
#include <complex>//plural class
#include <csignal>//signaling mechanism support
#include <csetjmp>//exception handling support
#include <cstdarg>//indefinite parameter list support
#include <cstddef>//Common constants
#include <cstdio>//define input/output functions
#include <cstdlib>//define miscellaneous functions and memory allocation functions
#include <cstring>//String processing
#include <ctime>//define functions for TIME
#include <cwchar>//wide character processing and input/output
#include <cwctype>//Wide character categories
#include <deque>//stl Dual-ended queue container
#include <exception>//exception handling classes
#include <fstream>//File input/output
#include <functional>//stl Defining an operation function (instead of an operator)
#include <limits>//define a variety of data type MAX-values constants
#include <list>//stl Linear list container
#include <locale>//localization of specific information
#include <map>//stl mapping container
#include <memory>//stl memory allocations through the allocator
#include <new>//Dynamic memory allocation
#include <numeric>//stl Common digital operations
#include <iomanip>/Parametric input/output
#include <ios>//Basic input/output support
#include <iosfwd>//input/output system use of the predecessor declaration
#include <iostream>//data stream input/output
#include <istream>//Basic input stream
#include <iterator>//stl iterators
#include <ostream>//Basic output stream
#include <queue>//stl Queue container
#include <set>//stl Collection container
#include <sstream>//string-based streaming
#include <stack>//stl Stack container
#include <stdexcept>//Standard Exception class
#include <streambuf>//Bottom input/output support
#include <string>//String class
#include <typeinfo>//run-time type information
#include <utility>//stl Generic template class
#include <valarray>//operations on arrays that contain values
#include <vector>//stl dynamic array container

————————————————————————————————

C99 Added Parts

#include <complex.h>//complex processing
#include <fenv.h>//floating-point environment
#include <inttypes.h>//integer format conversion
#include <stdbool.h>//Boolean environment
#include <stdint.h>//Integral environment
#include <tgmath.h>//general type Math macro

Header file Ctype.h
Character handling functions: This category function is used to process a single character, including the character's category test and the character's case conversion
----------------------------------------
Character tests whether letters and numbers isalnum
Whether the letter Isalpha
Whether to control character Iscntrl
Whether the number IsDigit
Whether characters can be displayed (except empty) isgraph
Whether characters (including spaces) can be displayed isprint
is neither a space nor a display character for letters and numbers ispunct
Whether the space isspace
Whether capital letter Isupper
Whether the 16 binary digits (0-9,a-f) character Isxdigit
Convert a character case conversion function to an uppercase letter ToUpper
Convert to lowercase letter ToLower

Header file Local.h
Localization: Functions in this category are used to deal with language differences in different countries.
----------------------------------------
Regional control Area setting setlocale
Number format Conventions Query the currency, date, time, etc. of the country for format conversion localeconv



Header file Math.h
Mathematical functions: This classification gives a variety of mathematical calculation functions, it must be reminded that the ANSIC standard data format does not conform to the IEEE754 standard, some C language compilers follow IEEE754 (such as Frinklin C51)
----------------------------------------

Inverse cosine ACOs
Anyway, string ASIN.
Anyway cut atan
Anyway cut 2 atan2
Cosine cos
Sine sin
Tangent tan

Hyperbolic cosine cosh
Hyperbolic sine sinh
Hyperbolic tangent tanh

exponential function exp
Exponential decomposition function frexp
Product exponential function Fdexp
Natural log Log
Logarithmic log10 with base 10
Floating-point decomposition function modf

Power Function Pow
Square root function sqrt

To find the lower limit close to integer ceil
Absolute Fabs
To find the upper limit close to integer floor
Finding the remainder Fmod



Header file Setjmp.h io.h
This classification function is used to implement a direct jump code between different bottom functions.
----------------------------------------
Save Call Environment setjmp
Recovering the calling Environment longjmp

Header file Signal.h
Signal Processing: This classification function is used to handle cases where exceptions occur during program execution.
----------------------------------------
Specifies the signal processing function signal
Send Signal raise


Header file Stdarg.h
Variable parameter handling: This class of functions is used to implement variable bottom functions such as printf,scanf parameters.
----------------------------------------
Variable-parameter access macros
Variable parameter start macro Va_start
Variable parameter end macro Va_end
Variable-parameter Access macros access the next variable-parameter macro va_arg


Header file Stdio.h
Input and OUTPUT functions: This classification is used to process various input, including files, consoles, and various functions are implemented in a "stream" manner.
----------------------------------------
Delete file Remove
Modify File name Rename
Generate temporary file name Tmpfile
Get temporary file path Tmpnam
File Access Close File fclose
Flush Buffer Fflush
Open File fopen
Connect the existing stream pointer to the new file Freopen
Set the disk buffer setbuf
Set the disk buffer setvbuf

formatting input and OUTPUT functions
Format Output fprintf
Format Input fscanf
Format output (console) printf
Format input (console) scanf
Format output to buffer sprintf
Enter SSCANF by format from the buffer
Formatted output vfprintf
Formatted output vprintf
Formatted output vsprintf

character input and output functions
Enter a character fgetc
String input fgets
Character Output FPUTC
String Output fputs
Character input (console) getc
Character input (console) GetChar
string input (console) gets
Character output (console) PUTC
Character output (console) Putchar
String output (console) puts
Character output to the head of the stream ungetc

Direct input and output
Direct Stream read Operation Fread
Direct Stream write Operation Fwrite

File Locator function
Get file location Fgetpos
File location Move fseek
File Location Settings Fsetpos
Get file Location Ftell
File location complex 0-bit remind

Error handling functions
Error clearing Clearerr
File End Judgment feof
File Error detection Ferror
Get the error prompt string perror

Header file Stdlib.h
Utility functions: This classification gives some functions that cannot be classified as above, but are necessary for programming.
----------------------------------------
String Conversion Functions
Converts a string to an integer atoi
Converts a string to a long integer ATOL
String converted to floating-point number strtod
Converts a string to a long integer strtol
string conversion to unsigned long integer strtoul

Pseudo-random sequence generation function
Generate random number Rand
Set the starting value of a random function srand

Storage management functions
Allocating Memory Calloc
Free memory
Memory allocation malloc
Reallocate Memory realloc

Environmental communications
Abort program Abort
Exit the program execution and clear the environment variable atexit
Exit Program Execution exit
Read Environment parameter getenv
Program hangs, temporarily executes a different program system
Search and sort tools Two-point lookup (data must be sorted) bsearch
Quick Sort Qsort
Integer operation function for absolute ABS
Get the division operation of the base quotient and remainder Div
Find the absolute value of the long plastic bottom labs
Quotient and remainder ldiv for long-shaped division
Multibyte-character function gets the number of bytes in a multi-byte character Mblen
Gets the number of bytes of multibyte character MBTOWC
Multibyte character Conversion wctomb
A multibyte character string operation converts a multibyte string to an array of integers mbstowcs
Convert a multibyte string to a character array Mcstowbs

Header file String.h
String processing: Functions in this category are used to combine, compare, and manipulate strings
----------------------------------------
String copy block copy (destination and source storage not overlapping) memcpy
Block copy (destination and source storage can overlap) memmove
String Copy strcpy
String copy by Length strncpy
String connection function Strings connection strcat
Concatenate strings by length Strncat
String comparison function block comparison memcmp
string comparison strcmp
string comparison (for non-English characters) strcoll
Comparison of strings by length strncmp
String Conversion strxfrm
Character and string lookup character lookup memchr
Character Lookup STRCHR
String Lookup strcspn
String Lookup strpbrk
String Lookup strspn
String Lookup Strstr
String Decomposition Strtok
Miscellaneous function String Settings memset
Error string Mapping strerror
Find string Length strlen

Header file Time.h
Date and Time functions: This category gives time and date processing functions
----------------------------------------
Time manipulation functions get processor Time clock
Get the time difference difftime
Set Time Mktime
Get time
Time conversion function Gets the time asctime in ASCII code
Gets the string representation of the time CTime
Gets the time in the specified format strftime


Ordinal Library category header file
----------------------------------------
1 Error Handling Errno.h
2 character processing Ctyphe.
3 Regional Local.h
4 Mathematical function math.h
5 Signal Processing Signal.h
6 Input/Output stdio.h
7 Utility Program Stdlib.h
8 String Processing String.h

A summary of common header files and functions in C + +

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.