0% found this document useful (0 votes)
3 views

ListOf C++Functions InThe StandardLibrary

The document lists various C++ standard library functions categorized by their respective header files, including <cmath>, <cstdlib>, <iostream>, <cstring>, <cctype>, <cstdio>, and <ctime>. Each category contains functions for mathematical operations, memory management, input/output, string manipulation, character classification, file handling, and date/time operations. Examples of functions include sqrt(), abs(), cin, memcpy(), isalpha(), and time().
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

ListOf C++Functions InThe StandardLibrary

The document lists various C++ standard library functions categorized by their respective header files, including <cmath>, <cstdlib>, <iostream>, <cstring>, <cctype>, <cstdio>, and <ctime>. Each category contains functions for mathematical operations, memory management, input/output, string manipulation, character classification, file handling, and date/time operations. Examples of functions include sqrt(), abs(), cin, memcpy(), isalpha(), and time().
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

List of c++

functions in the
standard library
C++ <cmath>
The C++ <cmath> header file declares a set of functions to perform mathematical
operations such as: sqrt() to calculate the square root, log() to find natural
logarithm of a number etc.

C++ acos()
Returns Inverse cosine a Number
C++ asin()
Returns Inverse Sine a Number
C++ atan()
Returns Inverse tangent a Number
C++ atan2()
Returns Inverse Tangent of a Coordinate
C++ ceil()
Return ceiling value of number
C++ cmath abs()
Returns absolute value of an argument
C++ cos()
Returns Cosine of the Argument
C++ exp()
returns exponential (e) raised to a number
C++ fabs()
Returns absolute value of argument
C++ floor()
Returns floor value of decimal number
C++ fmax()
returns largest among two arguments passed
C++ fmod()
Computes floating point remainder of division
C++ log()
Returns Natural Logarithm of a Number
C++ log10()
Returns Base 10 Logarithm of a Number
C++ log2()
returns base2 logarithm of a number
C++ modf()
Breaks Number Into Integral and Fractional Part
C++ nan()
returns a quiet NaN value
C++ pow()
Computes Power a Number
C++ remainder()
Returns remainder of x/y
C++ round()
Returns integral value nearest to argument
C++ sin()
Returns Sine of the Argument
C++ sqrt()
Computes Square Root of A Number
C++ tan()
Returns Tangent of the Argument
C++ trunc()
Truncates the demical part of a number

C++ <cstdlib>
The C++ <cstdlib> header file declares a set of general-purpose functions such
as: atof() to convert string to double. It also contains a few mathematical
functions. For example, abs() to find the absolute value of a number.

C++ atof()
Converts String to Double
C++ bsearch()
performs binary search on sorted array
C++ calloc()
allocates block of memory and initializes to zero
C++ cstdlib abs()
Returns absolute value of an integer
C++ div()
computes integral quotient and remainder of number
C++ free()
deallocates a block of memory
C++ getenv()
returns pointer to environment variable passed
C++ labs()
returns absolute value of long or long int number
C++ malloc()
Allocates a block of unitialized memory
C++ qsort()
sorts array using quick-sort algorithm
C++ realloc()
reallocates a block of previously allocated memory
C++ srand()
Seeds pseudo random number for rand()
C++ strtol()
Converts a string to number
C++ strtoull()
converts string to unsigned long long int

C++ <iostream>
The C++ <iostream> header file declares a set of functions for standard
Input/Output. It also defines I/O stream objects such as cin, cout, clog, etc.

C++ cerr
Writes to error stream
C++ cin
accepts input from the user
C++ clog
used for streaming logs
C++ cout
displays output to output device i.e monitor
C++ wcin
accepts input in wide character type
C++ wcout
displays wide characters (Unicode) to screen

C++ <cstring>
The C++ <cstring> header file declares a set of functions to work with C style
string (null terminated byte strings).

C++ memcpy()
Copies block of memory from source to destination
C++ memset()
copies character to beginning of string n times
C++ strcat()
appends copy of string to end of another string
C++ strchr()
searches for character in string
C++ strcmp()
Compare two strings
C++ strcpy()
Copies character string from source to destination
C++ strlen()
Returns length of given string
C++ strncmp()
compares two strings lexographically
C++ strncpy()
copies character string from source to destination
C++ strstr()
finds first occurrence of a substring in string
C++ strtok()
Split string based on delimiter

C++ <cctype>
The C++ <cctype> header file declares a set of functions to classify (and
transform) individual characters. For example, isupper() checks whether a
character is uppercase or not.

C++ isalpha()
checks if given character is alphabet or not
C++ isblank()
checks if given character is a blank character
C++ isdigit()
Checks if given character is a digit or not
C++ islower()
checks if given character is lowercase
C++ ispunct()
check if given character is punctuation character
C++ isspace()
check if given character is whitespace character
C++ isupper()
check if given character is uppercase or not
C++ isxdigit()
checks if given character is hexadecimal character
C++ tolower()
Converts a given character to lowercase
C++ toupper()
Converts a given character to uppercase

C++ <cstdio>
The C++ <cstdio> header file includes several macros and functions of C-style
input/output library.

C++ fflush()
flushes any buffered data to the respective device
C++ fgetc()
reads the next character from given input stream
C++ fgets()
reads n number of characters from file stream
C++ fopen()
opens specified file
C++ fprintf()
write a formatted string to file stream
C++ fread()
reads specified no. of characters from stream
C++ freopen()
opens a new file with stream associated to another
C++ fscanf()
read data from file stream
C++ fseek()
sets file position indicator for given file stream
C++ fwrite()
writes specified number of characters to stream
C++ getc()
reads next character from input stream
C++ getchar()
reads next character from stdin
C++ gets()
reads line from stdin
C++ printf()
Write formatted string to stdout
C++ putchar()
writes a character to stdout
C++ puts()
writes string to stdout
C++ remove()
Deletes the specified file
C++ rename()
renames or moves specified file
C++ scanf()
Read data form stdin
C++ snprintf()
write formatted string to character string buffer
C++ sprintf()
Write a formatted string to buffer
C++ sscanf()
read data from string buffer
C++ tmpfile()
creates temporary file with auto-generated name

C++ <ctime>
The C++ <ctime> header file declares a set of functions, macros and types to work
with date and time. For example, the time() function is used to get the current
time.

C++ asctime()
converts calendar time to character representation
C++ clock()
returns processor time consumed by program
C++ ctime()
converts time since epoch to char representation
C++ difftime()
computes difference between two times in seconds
C++ gmtime()
converts given time since epoch to UTC time
C++ localtime()
converts given time since epoch to local time
C++ strftime()
converts calendar time to multibyte character str
C++ time()
Returns current calendar time

You might also like