IncorrectOutput in C++