Date:

1. <iostream> – Input/Output Operations

Keyword / Function Function / Purpose
cout Prints output to the console.
cin Takes input from the user.
endl Moves cursor to the next line (like \n).
cerr Prints error messages to standard error.
clog Prints log messages to standard error.

2. <cmath> – Math Functions

Function / Keyword Function / Purpose
abs(x) Absolute value of x.
pow(x, y) x raised to the power y.
sqrt(x) Square root of x.
ceil(x) Smallest integer ≥ x.
floor(x) Largest integer ≤ x.
round(x) Rounds x to nearest integer.
sin(x), cos(x), tan(x) Trigonometric functions (angle in radians).
log(x) Natural logarithm (base e) of x.
exp(x) e raised to the power x.

3. <string> – String Operations

Function / Keyword Function / Purpose
std::string Declares a string variable.
.length() / .size() Returns length of string.
.append() Adds text to end of string.
.insert(pos, str) Inserts string at position.
.erase(pos, len) Deletes part of string.
.find(str) Finds first occurrence of substring.
.substr(pos, len) Returns substring starting at position.
.c_str() Converts string to C-style char array.
.compare(str) Compares two strings.

4. <vector> – Dynamic Arrays

Function / Keyword Function / Purpose
std::vector<Type> Declares a dynamic array (vector).
.push_back(value) Adds element at the end.
.pop_back() Removes last element.
.size() Returns number of elements.
.empty() Checks if vector is empty.
[index] Access element at given index.
.at(index) Access element with bounds checking.
.clear() Removes all elements.

5. <algorithm> – Algorithms for Containers

Function / Keyword Function / Purpose
sort(start, end) Sorts elements in ascending order.
reverse(start, end) Reverses elements.
max(a, b) Returns maximum of two values.
min(a, b) Returns minimum of two values.
swap(a, b) Swaps two values.
count(start, end, value) Counts occurrences of value.
find(start, end, value) Finds first occurrence of value.

6. <fstream> – File Handling

Function / Keyword Function / Purpose
std::ifstream Opens a file for reading.
std::ofstream Opens a file for writing.
std::fstream Opens a file for reading & writing.
.open(filename) Opens a file with given name.
.close() Closes the file.
.is_open() Checks if file is open.
.getline() Reads a line from a file.
<< / >> Writes to / reads from file (like cin / cout).

7. <cstdlib> – Standard Library Utilities

Function / Keyword Function / Purpose
rand() Generates a random integer.
srand(seed) Sets seed for random number generator.
exit(status) Terminates the program with a status code.
abs(x) Absolute value of integer (similar to <cmath>).
atoi(str) Converts string to integer.
atof(str) Converts string to float.

 

8. <ctime> – Date and Time

Function / Keyword Function / Purpose
time(NULL) Returns current time in seconds since epoch.
clock() Returns processor time used by program.
difftime(t1, t2) Returns difference in seconds between two times.
localtime() Converts time to local time structure.
strftime() Formats time as a string.

9. <iomanip> – Input/Output Manipulators

Function / Keyword Function / Purpose
std::setw(n) Sets width of output field.
std::setprecision(n) Sets decimal precision for floating-point numbers.
std::fixed Displays floating-point numbers in fixed format.
std::scientific Displays floating-point numbers in scientific notation.
std::setfill(c) Fills empty space with character c.

Share post:

Subscribe

spot_imgspot_img

Popular

More like this
Related

Burberry is the First Brand to get an Apple Music Channel Line

Find people with high expectations and a low tolerance...

For Composer Drew Silva, Music is all About Embracing Life

Find people with high expectations and a low tolerance...

Pixar Brings it’s Animated Movies to Life with Studio Music

Find people with high expectations and a low tolerance...

Concert Shows Will Stream on Netflix, Amazon and Hulu this Year

Find people with high expectations and a low tolerance...