1/71
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Ostream
short for 'output stream'; a class that supports output; provides the << operator (insertion operator)
Insertion operator
'<<'; for converting different types of data into a sequence of characters; returns a reference to the ostream that called the operator; is evaluated from left to right
Cout
a predefined ostream object that is pre-associated with a system's standard output, usually a computer screen
Istream
short for 'input stream'; a class that supports input; provides the >> operator (extraction operator) to extract data from a data buffer and write the data into different types of variables
Extraction operator
'>>'; skips leading whitespace, extracts as many characters as possible consistent with the target variable's type, converts the extracted characters to the target variable's type, and stores the result into the variable
Cin
a predefined istream pre-associated with a system's standard input, usually a computer keyboard
Manipulator
a function that overloads the insertion operator or extraction operator to adjust the way output appears; defined in the iomanip and ios libraries in namespace std
Floating-point manipulators
functions that format floating-point numbers for output
Fixed
Uses fixed-point notation; from
Scientific
Uses scientific notation; from
setprecision(p)
If stream has not been manipulated to fixed or scientific: sets max number of digits in number; If stream has been manipulated to fixed or scientific: sets max number of digits in fraction only (after the decimal point); from
showpoint
Even if the fraction is 0, show the decimal point and trailing 0s; the opposite is noshowpoint.
setw(n)
Sets character width for next output item.
setfill(c)
Sets fill character for output.
left
Aligns output to the left.
right
Aligns output to the right.
endl
Inserts newline and flushes output buffer.
flush
Flushes the output buffer without newline.
Function
Group of statements for repeated operations.
Function Definition
Specifies function name and statements block.
Function Call
Invokes a function to execute its statements.
Block
List of statements enclosed in braces.
Return Statement
Returns a value of specified type.
Parameter
Input specified in a function definition.
Argument
Value passed to a function's parameter.
Void function
Function that does not return a value.
Modular development
Divides program into testable modules.
Incremental development
Writes and tests small code increments.
Function stub
Function definition without implemented statements.
Unit testing
Tests individual parts of a program.
Testbench
Program to validate function outputs.
Test vector
Unique set of input values for testing.
Border cases
Extreme input scenarios for testing.
Stack frame
Local variables created for each function call.
Pass by value
Copies argument value into function parameter.
Pass by reference
Parameter refers to original argument's memory.
Reference
Variable type referring to another variable.
Const
Prevents modification of function parameters.
Scope
Visibility of variables within program parts.
Global variable
Declared outside any function, accessible globally.
Side effects
Function alters global variables beyond parameters.
Function declaration
Specifies return type, name, and parameters.
Default parameter value
Allows omission of corresponding argument in calls.
Function overloading
Multiple functions with same name, different parameters.
Algorithm
Sequence of steps for task completion.
Runtime
Time taken for algorithm execution.
Linear search
Searches list elements sequentially for key.
Binary search
Searches by checking middle element, halves search space.
Maximum steps for binary search
Requires [log2 N] + 1 steps for N elements.
Sorting
Process of arranging elements in order.
Selection sort
Sorts by selecting next value from unsorted part.
Comparisons in selection sort
Total comparisons proportional to (N-1)x(N/2).
Struct
Defines a new type with subitems.
Data member
Subitem defined within a struct.
Member access operator
Uses dot notation to access struct members.
#define directive
Macro definition that does not end with semicolon.
Pointer
Variable that holds a memory address.
Dynamically allocated array
Array size determined at runtime.
Appending to an array
Create new array, copy elements, delete old.
Member access operator (->)
Accesses members of an object via pointer.
Dereference operator (*)
Retrieves data pointed to by a pointer.
Delete operator
Deallocates memory allocated with new.
nullptr
Pointer assigned with null keyword.
strchr()
Finds first occurrence of character in string.
strrchr()
Finds last occurrence of character in string.
strstr()
Finds first occurrence of substring in string.
Recursive algorithm
Breaks problem into smaller subproblems recursively.
Base case
Describes a non-recursive step in recursion.
Recursive function
Function that calls itself for solving problems.
Fibonacci sequence
Sequence: 0, 1, 1, 2, 3, 5, 8, etc.
Greatest common divisor
Largest number evenly dividing two numbers.
Stack overflow
Occurs from deep recursion exceeding stack memory.