C++ standard library Flashcards
code written to be used as part of other programs
library
libraries give you access to ready made blank
libraries give access to
functions
data
values
Function example
getline( )
Data type example
vector
Value example
M_PI and M_e
#include iostream #include vector these are blank
libraries #include iostream #include vector
vector
map
array
these are blank
data types
vector
map
array
Features of C++ Standard Libraries include
blank and blank facilities
Input and output facilities
Features of C++ Standard libraries includes blank and blank facilities container blank blank blank functions implementation of useful blank the blank data type and more...
Features of C++ Standard Libraries include input and output facilities container data type mathematical functions implementation of useful algorithms the string data type and more...
#include vector #include map these are called blank
libraries but
these are container data types
to use the features of C++ Standard library, you must #include the appropriate
header
Examples of headers
#include iostream #include string #include vector
#include cmath #include cctype #include cstring #include cstdint #include climits these are all from
the older C standard library
yet still can be used by C++
char variable = ‘a’
char string = to upper(variable);
what would the output be
A
note that char is the data type
‘variable’ is the variable
toupper() uppercases what is in parentheses
#include cmath has advanced math functions such as pow(blank, blank) which returns blank raised to the power blank
pow(base, exponent)
which returns base raised to the power exponent
#include cmath also includes sqrt(x): returns the blank log(x): returns the natural base-e logarithm of blank log10(x): returns the base-10 logarithm of x abs(x): returns the blank sin(x), cos(x), tan(x): trigonometric functions
sqrt(x): returns the square root of x
log(x): returns the natural base-e logarithm of x
log10(x): returns the base-10 logarithm of x
abs(x): returns the absolute value
sin(x), cos(x), tan(x): trigonometric functions
#include cmath predefined values such a M_blank:
M_PI: Archimedes’ constant
M_E: Euler’s number
M_SQRT2: square root of 2
#include cctype contains functions for working with blank values
#include cctype contains functions for working with char values
#include cctype contains functions for working with char values isalnum(c): returns whether the character is alphanumeric isalpha(c): returns whether c is alphabetic isdigit(c): returns whether c is numeric islower(c): returns whether c is lower isupper(c): whether c is uppercase ispunct(c): whether it is punctuation isdigit(c): returns whether c is a hex digit
therefore we can see isblank return whether c is blank
therefore we can see isblank(c): returns whether c is blank
blanks are a container that allow you to associate a key value with a blanked value arbitrarily
maps are a container that allow you to associate a key value with a mapped value arbitrarily.
the blank blank can be used to look up the mapped value
key value can then be used to look up the mapped value
a map might associate a student names with test scores, allowing a test score to be looked up by name
therefore the map would have two types
string for names
double for test scores
to use maps, first put blank at the top of your program
to use maps, first put #include at the top of your program
to declare a map, declare it with the blank and blank types in blank
example: blank (anglebracket)string, double(anglebracket) variable;
to declare a map, declare it with the key and mapped value types in angle brackets
map(angle bracket)string, double(angle bracket) variable;