Write a function numLines that takes as a parameter an open input stream referencing a text file and returns as the function value the number of lines of text in the file. You may assume that the last character in the file is the newline character.
What will be an ideal response?
```
int numLines( ifstream& inf )
{
int lines = 0;
string oneLine;
for (getline( inf, oneLine ); !inf.fail(); getline( inf, oneLine ))
++lines;
return lines;
}
```
You might also like to view...
One or more objects may be created from a(n) __________.
a. field b. method c. instance d. class
Pixel aspect ratio means _____.
A. the ratio of a frame’s width (in pixels) to its height (in pixels) B. the ratio of a frame’s height (in pixels) to its width (in pixels) C. the ratio of a pixel’s width to its height D. the ratio of a pixel’s height to its width
On the computer, _______ means to store or transmit information with fewer bits.
Fill in the blank(s) with the appropriate word(s).
C2C stands for ________
Fill in the blank(s) with correct word