/* Here is a comment. This program reads characters until ^d is entered. It then prints the count of characters and the count of lines. */ #include using namespace std; int main() { char ch; int linecnt=0, charcnt=0; while (cin.get(ch)) { switch (ch) { case '\t': case ' ': break; case '\n': ++linecnt; break; default: ++charcnt; } } // Now print the line and character counts: cout << " linecnt: " << linecnt; cout << " charcnt: " << charcnt << endl; return 0; }