Chapter 5 looping
filename extension
A filename extension is a suffix (separated from the base filename by a dot or space) to the name of a computer file applied to indicate the encoding (file format) of its contents or usage.
file buffer
A small "holding section" of memory that file-bound data is first written to.
continue statement
A statement that causes the remainder of the current iteration of a loop to be skipped. The flow of execution goes back to the top of the loop, evaluates the condition, and if this is true the next iteration of the loop will begin.
The variable that is used to accumulate the total of the numbers is called an _______
Accumulator . It keeps a running total because it accumulates the total as it reads each number in the series.
OutputFile <<
Adds the output to the file
inputFile.close();
Closes the file associated with it
A _______ executes as long as a particular condition exists.
Conditional loop
A _______ is a loop that repeats a specific number of times
Count controlled loop
- -
Decrement operator
If you want to make sure a loop executes at least once, use the
Do-while loop
The ____ must be terminated with a semicolon after the closing parenthesis of the test expression
Do-while loop
fstream
File stream. Objects of this data type can be used to open files for reading, writing, or both.
The ______ is specifically designed to initialize, test, and update a counter variable.
For loop
outputfile.open()
For opening the output file to insert data
ifstream "i" "f" stream
For reading and existing file
inner loop
In a nested loop (a loop inside of another loop) the loop that is inside of another loop is considered the inner loop.
postfix
In the expression number++, the ++ operator is in what mode?
++
Increment operator
Infinite loops keep repeating until the program is interrupted
It does not contain a statement that chances the expression to false
A variable that controls the number of times a loop iterates is referred to as a ______
Loop control variable
The first line of the for loop is the ____
Loop header
The process of retrieving data from a file is known as ———
Reading data
inputfile >>
Reads data from the file
tolower
Returns a copy of this string converted to lowercase
toupper
Returns a copy of this string converted to uppercase
fail member function
Returns true when an attempted file operation fails
A _____ is a special value that marks the end of a list of values.
Sentinel
A ______ is a special value that cannot be mistaken for a member of the list and that signals that there are no more values to be entered.
Sentinel
#include<fstream>
The header file in code for reading and writing files
file name
The name assigned to a file when it is saved
Prefix mode
The operator is placed before the variable. The increment or decrement will happen first.
decrement
To decrease, usually by 1; the opposite of increment.
ofstream "o" "f" stream
To write data to a file
Num = num - 1; Num += 1; Num ++ All increment the value of num variable by 1
True
The for loop is also a pretest loop, it evaluates the test expression before it iterates
True
To use toupper and tolower you must include the cctype file in your program. #include <ccytpe>
True
Using a break statement with a loop allows a way to leave iteration early
True
stringObject.c_str() returns the contents of the object formatted as a null terminated c-string
Using the c_str member function in older versions of c++
The ______ can be used to create input routines that repeat until acceptable data is entered.
While loop
sequential access file
You *access* the data from the beginning of the file to the end of the file.
output file
a file that a program writes data to
outer loop
a loop that contains another loop
random access file (direct access file)
able to jump directly to any piece of data in a file without reading the data that comes before it
file stream object
an object that is associated with a specific file and provides a way for a program to work with that file. - stream aka stream of data
The priming read is placed ________ the loop.
before
ofstream, ifstream, and fstream are:
data types
The ______ is a post-test loop, which means it's expression is tested after each iteration
do-while loop
EOF
end of file
increment
increase
writing data
process of saving data in a file (a piece of data is copied from a variable RAM to the file)
A file's ________ marks the location of the next byte that will be read from the file.
read position
_______ is a pretest loop. This means it tests its condition before each iteration. If the test expression is false to start with, the loop will never iterate.
while
The ______ has two important parts: 1 an expression that is tested for a true or false value and 2 a statement or block that is repeated as long as the expression is true.
while loop