Extra output when writing to file using std::cout

I am trying to read data from a file in.txt, and after some computations, I am writing the output to out.txt Why is there an extra 7 at the end of out.txt? Contents of Solution class. class Solution { public: int findComplement(int num) { int powerof2 = 2, temp = num; /* get number of… Read More Extra output when writing to file using std::cout