Chapter 3 Textbook Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

For file I/O, you must use the statement ________________________ to include the header file __________ in the program. You must also do the following: declare variables of type _____________ for file input and of type ___________ for file output and use open statements to open input and output files. You can use ___, ___, _____, ___________, ______, __________, or ______ with file stream variables.

#include <fstream>; fstream; ifstream; ofstream; <<; >>; get; ignore; peek; putback; clear

In C++, _______________________________ is the ______________________.

' (single-quote mark); digit separator

The manipulator ________ outputs floating-point numbers in the ___________________ format.

fixed; fixed decimal

The header file __________ contains the definitions of ___________ and ___________.

fstream; ifstream; ofstream

The function ____ is used to read data on a _______________________________________ and ____________________ any ________________________________.

get; character-by-character; does not skip; whitespace characters

To use the stream functions ______, __________, ______, _______, _________, and ________ for standard I/O, the program must include the header file ___________.

get; ignore; putback; peek; clear; unsetf; iostream

The manipulator _______________ outputs floating-point numbers with a ____________________ and __________________.

showpoint; decimal point; trailing zeros

an infinite sequence of characters in C++ that form a source to a destination

stream

Attempting to read invalid data into a variable causes the input stream to enter _________________.

the fail state

When the ___ is used with an ______________________________, such as _____, it is called the ________________________________________. The __________ operand of ___ must be an _______________________________, such as ____; the ____________ operand must be a ____________.

>>; input stream object; cin; stream extraction operator; left-side; >>; input stream variable; cin; right-side; variable

When the ___ is used with an ______________________________, such as _____, it is called the ________________________________________. The __________ operand of ___ must be an _______________________________, such as ____; the ____________ operand must be an _________________________________________.

<<; output stream object; cout; stream insertion operator; left-side; <<; output stream variable; cout; right-side; <<; expression or a manipulator

When inputting data into a variable, the operator ____ skips ____________________________________________.

>>; all leading whitespace characters

stands for common input; input stream object; typically initialized to the standard input device, which is the keyboard

cin

To use ___ and _____, the program must include the header file _____________.

cin; cout; iostream

Once an input failure has occurred, you use the function ______ to restore the input stream to a working state.

clear

stands for common output; output stream object; typically initialized to the standard output device, which is the screen

cout

To close a file as indicated by the ____________ variable _______, you use the statement _________________. To close a file as indicate by the ___________ variable ___________, you use the statement ____________________.

ifstream; inFile; inFile.close();; ofstream; outFile; outFile.close();

The function _________ is used to skip data in a line.

ignore

a stream from a source to a computer

input stream

a stream from a computer to a destination

output stream

The function _____ returns the next character from the input stream but does not remove the character from the input stream.

peek

The function ___________ puts the last character retrieved by the function get back into the input stream.

putback

The manipulator _________ is used to fill the unused columns on an output device with a character other than a space.

setfill

To use the manipulators _________________, ______, and ___________, the program must include the header file ___________.

setprecision; setw; setfill; iomanip

The manipulator __________________ formats the output of floating-point numbers to a _______________ number of decimal places.

setprecision; specified

The manipulator ______ formats the output of an expression in a specific number of columns; the default output is right-justified.

setw

If the number of columns specified in the _____ manipulator ___________ the number of columns required by the next expression, the output is _____________________. To _______________ the output, you use the manipulator ______.

setw; exceeds; right-justified; left-justify; left

If the number of columns specified in the argument of ______ is _____ than the number of columns needed to print the value of the expression, the output is _________________ and the output of the expression ___________________________________________________________.

setw; less; not truncated; expands to the required number of columns


Conjuntos de estudio relacionados

Unit 1 Test STA 2023 McGraw Hill

View Set

Sociology - EXAM 2 - Study Guide

View Set