Which of the following are correct ways to end a loop using a test for end-of-file?
a) ```
while(inStream->next)
{
cout << next;
}
```
b) ```
while(inStream >> next)
cout << next;
```
c) ```
inStream.get(next)
while(!inStream.eof( ))
{
cout << next;
inStream.get(next);
}
```
d) ```
inStream.get(next)
while(!eof(inStream))
{
cout << next;
inStream.get(next);
}
```
e) None of the above. You cannot control a loop using a test for end of file.
b) ```
while(inStream >> next)
cout << next;
```
and
c) ```
inStream.get(next)
while(!inStream.eof( ))
{
cout << next;
inStream.get(next);
}
```
Part a) The answer mistakes -> (access to a member through a pointer) for >> (overloaded operator to do stream extraction. Part b) the inStream>>next returns a reference to a inStream object. The stream class has a conversion that is automatically called in this context to convert a stream in a good state to true, and a stream in a bad state to false. Part c) supplies the details. Part d) mistakes the eof member function to be a standalone function.
You might also like to view...
Given here are the general steps of image retouching of a scanned image.
i. Order the steps by labeling 1 through 6. _____ Adjust the overall contrast or tonal range of the image _____ Crop and straighten the image _____ Fine-tune specific parts of the image _____ Remove color casts _____ Remove dirt and dust _____ Sharpen the image ii. Explain your choice for the first step. iii. Explain your choice for the last step.
When referencing a worksheet in another workbook, the workbook name is enclosed in ________
A) parentheses ( ) B) brackets [ ] C) double quotation marks " " D) braces { }
The unordered, or bulleted, lists use the following tags: ____.
A.
Name one advantage and one disadvantage of using tapes for backup media.
What will be an ideal response?