
please wait
|
|
|
|
ifstream
object as reference instead of value, i.e. modify the function prototype and implementation as follows:void IsEven(ifstream& din);
even = even ++;
assigns the existing value of the variable to itself, and then post-increments the rvalue, which results in the value remaining 0. There's an easy fix for this: just replace the assignment with ++even;
. The same applies for odd
, obviously.