Thanks!
I'm surprised the problem seems to be with the higher precedence of the operator "<<" in this case cout << tmp_int << ((j+1)%20) ? "\t":"\n"; which needs to be bracketed as cout << tmp_int...
I'm trying to print out integers and space/newline for a nicer output, for example, every 20 integers in a row with ternary operator.
In C I could do it with:printf("%d%s",tmp_int, ((j+1)%20) ?...