1/59
Looks like no tags are added yet.
statements are written in order to accomplish a specific activity.
sequential programming
are expressions that evaluate to either true or false
conditionals
is used to describe a situation in which a sequence of instructions can be executed multiple times
iterative
contains declarations of functions, classes, and other program components that can be used in a C++ program.
header file
Input and output operations
iostream
String data type and operations
<string>
Mathematical functions
cmath
Output formatting
iomanip
file handling
fstream
is the starting point of program execution.
The main() function
is a named storage location used to hold data that may change during program execution.
variable
is a value that cannot be changed after it has been initialized.
constant
is the name given to variables, functions, classes, and other program elements.
identifier
are symbols used to perform operations on variables and values.
operators
={ ||, &&, !}
logical operaotrs
(++, -- , example x++ or x--)
increment and decrement operators
perform operations on individual bits of integer values. (&, |, ^, ~, <<, >>)
bitwise operators
is a block of code designed to perform a specific task. It allows programmers to organize instructions into smaller, reusable sections of a program.
function
returnType functionName(parameterList) {
// Statements
return value;
basic structure of function
Informs the compiler about the function's name, return type, and parameters.
function declaration
Contains the actual instructions of the function.
function definition
Executes the function.
function calling
Variables declared in the function definition. |
Receive the values. |
Example: int a, int b |
parameters
Actual values passed when calling a function. |
Supply the values. |
Example: 10, 20 |
arguements
This function does not receive any information and does not return a value.
Function Without Parameters and Without Return Value
This function receives values but does not return a result.
Function With Parameters and Without Return Value
This function does not receive any information but returns a value.
Function Without Parameters but With Return Value
This function receives values, performs a task, and returns a result.
Function With Parameters and With Return Value
These operators compare two values.
relational operators
{=-*/ %}
arithmetic operators
is a data structure that allows programmers to store multiple values of the same data type using a single variable name.
array
Instead of declaring several variables individually, we can use an array to organize and manage related data more efficiently.
array
is an array that stores elements in a single sequence or list.
one dimensional
The general syntax for declaring an array is:
dataType arrayName[arraySize];
explanation of array
dataType arrayName[arraySize];
dataType – specifies the type of values to store.
arrayName – the name given to the array.
arraySize – specifies the number of elements
means assigning initial values to the elements of an array.
array initialization
means retrieving or using individual values stored in an array.
Accessing array elements
is commonly used to process array elements.
It allows programmers to access each element automatically without writing separate statements.
for loop
is called simple if variables of that type can store only one value at a time
data type
is one in which each data item is a collection of other data items
structured data type
a collection of a fixed number of components wherein all of the components have the same data type
array
the array subscripting operator
[]
The array index always starts at
0
is any expression whose value is a nonnegative integer
index
•collection of a fixed number of components (of the same type) arranged in two dimensions
–Sometimes called matrices or tables
two-dimensional array
is the memory address of a variable
pointer
computer’s memory is divided into numbered memory locations called
bytes
is a construct that gives you more control of the computer’s memory.
pointer
means "the variable located at the address"
*
means "the address of the variable
&
Type_Name Variable_Name1, Variable_Name2,. . .;
syntax of pointers
creates a new dynamic variable of a specified type and returns a pointer that points to this new variable.
new operator
if there was insufficient available memory to create the new variable, then new returned a special value named
null
•A special area of memory
•Reserved for dynamically allocated variables
•Any new dynamic variable created by a program consumes some of the memory in this
freestore/heap
is a special constant pointer value that is used to give a value to a pointer variable that would not otherwise have a value.
null
Local variables are sometimes called ____ because their dynamic properties are controlled automatically for you.
automatic variables
Global variables are sometimes called ______because they are truly static in contrast to dynamic and automatic
variables
statically allocated variables
variables declared within a function definition
local variables
Variables created with the new operator are called ______ because they are created and destroyed while the program is running.
dynamic variables
are normally placed outside the body of the main part of your program and outside the body of other functions, typically near the start of a file. That way the typedef is global and available to your entire program.
type definitions