Electrical and Computer Engineering
10 of 19
UAH
CPE 112
Side Effects Illustrated
•void CountChars();
•int count = 0;    // Supposed to count input lines
•char ch;          // Hold one input character
•int main()
•{
•   cin.get(ch);
•   while(cin)
•   {
•      count++;
•      CountChars();
•      cin.get(ch);
•   }
•   cout << count << “ lines of input processed.” << endl;
•   return 0;
•}