Thank you, but what exactly does the 2 there do, As it seem to do nothing
Thank you the = and == is to evil, I could also do this cout << ((*itbeg % 2 == 1) ? *itbeg += *itbeg : *itbeg) << endl; // <-
I said you can put any number ,in your case you dont need a second case check
the Ternary Operators "?" evaluate a true or false result from the condition
condition ? true result : false result
you only need one : square the odd number you have cout << ((*itbeg % 2 == 1) ? *itbeg += *itbeg : *itbeg) << endl; I would go with this line