CS 135 - Chap 5

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

These are operators that add and subtract one from their operands

++ and --

What will the following code display int number = 6; int x = 0; x = number--; cout << x << endl;

6

Describe an infinite loop

A loop that has no way of stopping

What is a running total

Accumulated sum of numbers from a repeating loop

True/False an initialization expression may be omitted from the for loop if no initialization is required for (int i = 0 .... get rid of int

True

True/False it is possible to define a file stream object and open a file in one statement

True

Can you use a break statement in a nested loop?

Yes

What is a loop control variable

a counter that controls execution of a loop

Example of a sentinal

a special value that cannot be confused with a valid value (-999)

Variable that holds a running total

accumulator

a file ___ is a small holding section of memory that info going to a file is written to first

buffer

This is a variable that is regularly incremented or decremented each time a loop iterates

counter

This loop is a good choice when you know how many times you want the loop to iterate

for

header file for file access is #include

fstream

read data FROM a file with

ifstream

Define an output file object with

ofstream

outFile isa file stream object and number is a variable, which statement writes contents of number to outFile?

outFile << number;

Send data to a file with:

outfile << "data";

What type of loop is a do while loop

posttest

when the increment operator precedes its operand, like ++number, the expression is in this mode

prefix

What type of loop is a for loop

pretest

This is a special value that marks the end of a list of values

sentinal

True/False you can pass a string object as an argument to a file stream objects open member function

true

This is pre-test loop that is ideal where you dont want loop to iterate if condition is false

while

This statement nay be used to stop a loop's current iteration and skip to the next one

continue

A control structure that causes a statement to repeat:

loop

open a file to write to:

outfile.open("name.txt");


Conjuntos de estudio relacionados

Music Appreciation Unit One Quizzes

View Set

Penny Review : Ovaries and Fallopian Tubes

View Set

Chapter 14--Media Planning and Buying

View Set

FINAL EXAM REVIEW: Nixon, Watergate, Ford, Carter Submit Assignment

View Set

HW3: Homework - Ch.3: Supply and Demand

View Set

Life Insurance Policies - Provisions, Options and Riders 1

View Set