#include #include #include #include using namespace std; int main() { // Reading one char at a time char str[80]; int char_count; int eol_count; char ch; ifstream myfile("files-many.txt"); if (myfile.fail()) { cout << "Fail bit set" << endl; return 1; } char_count = 0; eol_count = 0; while (true) { ch = myfile.get(); if (myfile.eof()) { cout << "end of file" << endl; break; } if (ch == '\n') eol_count++; char_count++; } cout << "char count is " << char_count << endl; cout << "eol count is " << eol_count << endl; myfile.close(); myfile.clear(); return 0; }