I believe that when you write C/C++ programs, one of the most essential parts is the header file. However, because the header files corresponding to different functions are different, some people (especially me) often encounter the dilemma of forgetting the required header files when writing code. In order to solve this problem, today I specially collected C++ Commonly used header files and the library functions they contain, I hope to help everyone. (Due to space limitations, I just briefly introduce each header file. For more detailed usage, please refer to the link I attached)
1."iostream" (input&output stream)
#include<iostream>
common use
Input stream " cin>> " and output stream " cout<< ", the following data types can be int, float, double, string, etc., which is quite convenient and recommended.
learn more:
2."stdio.h" (standard buffered input&output)
#include<stdio.h>
This is originally a header file in the C language standard function library, but it becomes "cstdio" in C++ (the two are actually similar).
common use
Formatted input "scanf()" and formatted output "printf()" are rich in functions, but compared with "cin" and "cout", it is slightly cumbersome.
It is also a very useful header file.
learn more:
3."cmath" ( "math.h" )
#include<cmath>
Like "cstdio", the "predecessor" of "cmath" is the header file "math.h" in the C language standard function library, which contains a large number of mathematical formulas for easy calculation.
common use
Find the absolute value "abs()", the sine value "sin()", etc., I won't list them one by one, if you want to know, you can see the link below.
learn more
4."windows.h"
#include<windows.h>
This is a magical header file that can be explored by yourself. (To put it bluntly, I also know less)
common use
"GetAsyncKeyState()()" determines whether a key is pressed.
"system("cls")" clears the screen.
"Sleep()" delay in milliseconds.
learn more
5."algorithm"
#include<algorithm>
This is the standard algorithm library for C++
common use
Find the maximum value "max()", find the minimum value "min()", sort function "sort()", etc.
learn more
6."string" "string.h" "cstring"
These three are header files related to the use of strings
The main purpose
The array initialization function "memset()" inserts the string "insert()", removes the string "erase()", etc.
learn more
6."bits/stdc++.h"
#include<bits/stdc++.h>
It is called the "universal header file" of C++, which shows how powerful it is, but I didn't put it in front because its shortcomings are also very obvious-it will greatly slow down the speed of the program. This header file almost contains There are about dozens of library functions in C++, but many of them are not used by us. Therefore, it is recommended to use whatever header files are needed . did not say)
The main purpose
I don't need to say more.
learn more
Well, that’s all for this sharing, thank you for watching!
I have read this far, can you kindly give me a three-link ヾ(≧▽≦*)o
(Such a good article, don’t rush to collect it)