64 659
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #57943 in C++ for mabswhale

Question #57943
How to count number of entries in a txt file ?
Expert's answer
int main() {
int number_of_lines = 0;
std::string line;
std::ifstream inpFile("file.txt");
while (std::getline(inpFile, line))
++numberOfLines;
std::cout << "Number of lines in text file: " << numberOfLines;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions