c++ chapters 5-7

++ --

operators that add and subtract one from their operands

prefix increment

increments value of operand then used value in context

what are the two parts of a while loop?

Expression and block

Pre-test loop

what kind of test is a while loop?

place a semi colon after the test expression

how to make a while loop a null statement?

never

statements in a while loop may ___ be executed

at least once

statements in a do while loop may be executed ___

initialization, test, and update

what are the three expressions of a for loop

initialization

only executed once in a for loop

post test loop

what kind of test is a do while loop?

continue statement

used to stop a loops current iteration and begin the next one

increment

increase value by one

decrement

decrease value by one

prefix mode

when increment operator precedes its operand

loop

control structure that causes a statement or group of statements to repeat

something to make it false

what must you include in a while loop so that it doesnt become an infinite loop

counter

variable that is incremented or decremented each time a loop iterates

sentinel

special value that marks the end of a list of values

when you know how many time you want to iterate

when is a for loop a good choice

break

causes a loop to terminate early

fstream

to allow file access in a program you must include this file header

file buffer

a small holding section of memory that file bound information is written to

stream insertion operator

used to write into a file

ofstream

to write data to a file you must define an object with this data type

ifstream

to read data from a file you must define an object with this data type

outfile<< number

writes teh contents of number to the file

dataFile.close()

closes a file

opened

what must a file be before data can be written to or read from it

arrays

can hold multiple variables

elements

individual values contained in arrays

int array[10];

valid array definition

int grades[] = [100,90..];

implicit array sizing

by using same subscript

how can you build relationships between data stored in two or more arrays

name

__ of an array stores memory address of the first array element

several identical arrays put together

a two dimensional array is like....

rows and columns

a two dimensional array can be viewed as...

data type

arrays values must be ______ to be stored

constant integer expression

an arrays size declarator must be a ______ with a value greater than zero

zero

subscript numbering begins with ___

initialized, declared

arrays may be ___ at the time they are ___

for loop

an array can easily be stepped through by using a...

range variable

the range-based for loop is designed to work with a built in variable known as...

loop

to assign the contents of one array to another you must use a...

name of an array

you pass the ____ to pass it as an argument to a function

one

a two dimensional array can have elements of ___ data type

same length, different length, and uninitialized elements

a two dimensional array of characters can contain strings of :

an initialization list

can be used to specify the starting values of an array

null terminator

is automatically appended to a character array when it is iitialized with a string constant

illegal

an array with no element is ___ in c++

legal

it is ___ to pass an argument to a function that contains an individual array element

vector < int > v;

correctly defines a vector

vector < int > n {10, 20}

correctly inititalizes a vector of ints named n with values 10 & 20

vector < int > v(10);

creates a vector object with a starting size of 10

vector < int > v (10,2);

creates a vector object with a starting size of 10 and initializes all values to 2

push_back

inserts item into a vector

size

returns the number of elements in a vector

pop_back

removes an item from a vector

empty

returns true if vector has no elements

true

amount of memory used by an array depends on data type and number of elements in array

false

an array inittialized list must be placed on one single line

true

when you pass an array to a function the function can modify the contents of the array

true

you cannot use a range-based loop to modify the contents of an array unless you declare the range variable as a reference

false

if you store data past an arrays boundaries it will issue an error

function

collection of statements that perform a specific task

function definition

contains the statements that make up the function

only one

a function can have many parameters but return _____ value

called

a function is executed when it is ___

local variable

defined inside a function and not accessible outside

static variable

persists between function calls

default arguments

passed to parameters automatically if no argument is provided in function call

reference variable

allows a function to access the parameters original argument

return statement

causing function to end

exit()

causes function to terminate immediately

function call

statement that causes a function to execute

argument

info passed to a function

parameter

info received by a function

function prototype

eliminates the need to place a function definition before all calls to a function

global variable

declared outisde all functions

stub

dummy function

true

a parameter is a special variable declared inside ()

false

a functions return data type must be the same as the fucntion prototype

false

when a function is called flow control moves to a function prototyep