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;
}
```

Computer Science & Information Technology

You might also like to view...

________ are used to list the contents of the left pane in Slide Master view

A) Icons B) Thumbnails C) Screen shots D) Outline text

Computer Science & Information Technology

It is recommended that you start file names with numbers to better your Google rankings

Indicate whether the statement is true or false

Computer Science & Information Technology