If you want to print all numbers backward from 10-1, whichcode segment will do i
ID: 3615843 • Letter: I
Question
If you want to print all numbers backward from 10-1, whichcode segment will do it? for (i = limit; i > = 1; i--) cout << " " << i << endl; A) for (i=10; i>=10; i+=1) cout << " " << i <<endl;B) for (i=10; i>=1; i-=1) cout << " " << i <<endl;
C) for (i=10; i>1; i-=2) cout << " " << i <<endl;
D) for (i=10; i>0; i-=1) cout << " " << i <<endl; To determine whether a file was opened successfully, one canuse the ___________ fstream member function. A)close( )
B)overloaded operator <<( )
C)open( )
D)flush( )
If you want to print all numbers backward from 10-1, whichcode segment will do it? for (i = limit; i > = 1; i--) cout << " " << i << endl; A) for (i=10; i>=10; i+=1) cout << " " << i <<endl;
B) for (i=10; i>=1; i-=1) cout << " " << i <<endl;
C) for (i=10; i>1; i-=2) cout << " " << i <<endl;
D) for (i=10; i>0; i-=1) cout << " " << i <<endl; To determine whether a file was opened successfully, one canuse the ___________ fstream member function. A)close( )
B)overloaded operator <<( )
C)open( )
D)flush( )
To determine whether a file was opened successfully, one canuse the ___________ fstream member function. A)close( )
B)overloaded operator <<( )
C)open( )
D)flush( )
To determine whether a file was opened successfully, one canuse the ___________ fstream member function.
Explanation / Answer
If you want to print all numbers backward from 10-1, whichcode segment will do it? for (i = limit; i > = 1; i--) cout << " " << i << endl; To determine whether a file was opened successfully, one canuse the ___________ fstream member function. A) close( )B) overloaded operator <<( )
C) open( )
D) flush( )
(A) will simply close a file.
(B) performs an output operation on a streamgenerally involving some sort of formatting of the data.
(C) Opens a file whose name is s, associating itscontent with the stream object to perform input/output operationson it. The operations allowed and some operating details depend onparameter mode.
The function effectively calls rdbuf()->open(filename,mode).
If the object already has a file associated (open), thefunction fails.
On failure, the failbit flag is set (which can be checkedwith member fail), and depending on the value set with exceptionsan exception may be thrown.
(D) synchronizes the buffer associated with the stream toits controlled output sequence.
To determine whether a file was opened successfully, one canuse the ___________ fstream member function.