• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/14

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

14 Cards in this Set

  • Front
  • Back

pretest loops and posttest loops

A pretest looptests its condition before each iteration. A posttest loop tests its conditionafter each iteration. A posttest loop will always execute at least once.(do-while)


type do you use when you want to create a file stream object that


can writedata to a file?


can readdata from a file?

ofstream


ifstream


tworeasons a program should close files when it is finished using them


·Closinga file causes any unsaved data that may still be held in a buffer to be savedto its file. This means the data will be in the file if you need to read itlater in the same program.


·Someoperating systems limit the number of files that may be open at one time. Whena program closes files that are no longer being used, it will not deplete moreof the operating system’s resources than necessary.


Each repetition of a loop is known as

iteration

is a special value that marks the end of a series of values.

sentinel


Inside the for loop’s parentheses, the first expression is the __________ , the secondexpression is the __________ , and the third expression is the __________.

initialization, test, update

for( ; ; )

Write code that does the following: Opens an output file with the filename Numbers.txt,uses a loop to write the numbers 1 through 100 to the file, and then closes the file.



ofstream outputFile("Numbers.txt"); for(int number = 1; number <= 100; number++) outputFile<< number << endl; outputFile.close();


Why do local variables lose their values between calls to the function in which they aredefined?

Because they are created in memory when thefunction begins execution, and are destroyed when the function ends.


If you are writing a function that accepts an argument and you want to make sure thefunction cannot change the value of the argument, what do you do?

If the argumentis passed by value, nothing needs to be done. The function cannot access theargument. If the argument is passed by reference, the parameter should bedefined with the const key word.


Values that are sent into a function are called _________.

argument

_________ eliminates the need to place a function definition before all calls to thefunction.

prototype


The _________ statement causes a function to end immediately.

return

The value of a default argument must be a(n) _________.

constant

Twoormorefunctionsmayhavethesamename,aslongastheir_________aredifferent.

parameter lists