Lesson 1 PREFINALS Flashcards
It is used to “jump out” of a switch statement.
Break Statement
It can also be used to jump out of a loop.
Break Statement
This statement breaks one iteration
(in the loop), if a specified condition occurs,
and continues with the
next iteration in the loop.
Continue Statement
It allows us to
execute specific blocks of code a number of
times.
Repetition Control Structures
is a statement or block of
statements that is repeated as long as some condition is satisfied.
While loop
the statement inside this loop is executed several times as long as the condition is satisfied.
Do while loop
It allows execution of the same code a number of times.
for loop
It Initializes the loop variable.
Initialization Expression
It compares the loop variable to some limit value
Loop Condition
It updates the loop variable
Step Expression
These are used to store multiple values in a single variable, instead of declaring separate variables for each value.
Arrays
To declare this, define the variable type, specify the name of the array followed by square brackets and specify the number of elements it should store:
Array
You can access an array element by referring to the index number inside _______
Square Brackets []
These are like a row of boxes where you can store things where each box can hold one item, such as a number or a word. For example, in an array of numbers, the first box might hold 5, the second 10, and so on
1D Arrays
In 1D Array, you can easily find or change what’s in each box by referring to its position, called an _______.
Index
These are handy because they let you store lots of related data in one place and access it quickly.
Arrays
You can loop through the array elements with the _______.
for loops
This is introduced in C++ version 11 (2011), which is used exclusively to loop through elements in an array (and other data structures, like vectors and lists)
for-each loop
you can iterate through an array by using an _______to access each element.
Index
you don’t have to specify the size of the array. The compiler is smart enough to determine the size of the array based on the number of inserted values:
Omit Array Size
It ______ operator is used to determine the memory size of types or objects in bytes.
sizeof operator
It can help calculate the number of elements in a static array (an array whose size is fixed at compile time).
sizeof operator
is essentially an array of arrays. It’s a way to store data in a grid or matrix format, where each element is accessed by two indices: one for the row and one for the column.
2D Array
This structure is commonly used for tasks involving tables, grids, or matrices, like representing a chessboard, image data, or other tabular information.
2D Array
It is a collection of two-dimensional arrays.
3D Array
It can be visualized as multiple 2D arrays stacked on top of each other
3D Array
It is an extension of a 2D array, where each element of it is accessed using three indices
3D Array
It is an array that has more than one dimension, allowing you to store and manipulate data in a grid, table, or higher-dimensional structure. Each dimension represents a level of data organization, such as rows, columns, and layers.
Multi-Dimensional Array
It is an array of arrays. To declare it, define the variable type, specify the name of the array followed by square brackets which specify how many elements the main array has, followed by another set of square brackets which indicates how many elements the sub-arrays have:
Multi-Dimensional Array