Electrical and Computer Engineering
11 of 19
UAH
CPE 112
Side Effects Illustrated (continued)
•void CountChars()
•
•// Counts the number of characters on one input line
•// and prints the count Note: main() has already
•// read the first character on a line
•{
•   count = 0;
•   while (ch != ‘\n’)
•   {
•      count++;
•      cin.get(ch);
•   }
•   cout << count << “characters on this line.” << endl;
•}