void countLines() { ifstream fin(“NOTES.TXT”); char ch[80]; int count=0; if (!fin) { cout<<”Error opening file!” ; exit(0); } while(1) { fin.getline(ch,70,‘.’); if (fin.eof()) break; count++; } fin.close(); cout<<"There are "<<count<<" Lines in NOTES.TXT file."; } void main() { countLines(); }
No comments
Post your comments