Chapter 5 - Loops and Files Flashcards
Define: nested loop
A loop that is inside another loop
The fill member function of cout changes the fill character which is a _____ by default.
The fill member function of cout changes the fill character which is a SPACE by default.
If you use:
cout.fill(‘0’);
the fill function will cause a ___ to be printed in front of all single digit numbers.
ZERO
An inner loop goes through ___ of its iterations for EACH iteration of an outer loop.
ALL
Inner loops complete their iterations (faster/slower) than outer loops.
FASTER
To get the total number of iterations of a nested loops, multiply ….
the number of iterations of ALL loops.
Define writing data
process of saving data to the file
When a piece of data is written to a file, it is copied from a _______ in ______ to the ______.
When a piece of data is written to a file, it is copied from a VARIABLE in RAM to the FILE.
Define reading data
process of RETRIEVING data from a file
When a piece of data is READ from a file, it is copied from the _____ into a _____ in _____.
When a piece of data is read from a file it is copied from the FILE into a VARIABLE in RAM.
input file
file from which data is read
Input file is called an input file because the program gets ____ from the ____.
gets INPUT from the FILE.
When a file is used by a program, what 3 steps must be taken?
1) Open the file (connect the file to the program)
2) Process the file (data written/read to file)
3) Close the file (disconnect the file from the program)
What are the 2 types of files?
1) Text
2) Binary
File Access Methods - what are the 2 general ways to access data?
1) sequential-access file (like a tape)
2) random-access file (also known as direct access file) - like a CD