To fix this problem Change else if (!inquotes && (c == '\r' || c == '\n')) to else if (!inquotes && (c == '\r' || c == '\n' || in.eof())) :)
To fix this problem
Change
else if (!inquotes && (c == '\r' || c == '\n'))
to
else if (!inquotes && (c == '\r' || c == '\n' || in.eof()))
:)