So this code should print the reverse of any number user enters
example: 123
output: 321
but in line "16" can I remove cout << "-"; but still print the number with the negative value .
Note: I know how to code it without array, but array is needed..
You can either change the sign of the first element of arr that is being printed out (multiply it by negative 1), or leave the cout << "-" in there. Unless you don't need it to be negative. If you just want the reverse of the number, then you can remove that cout statement and it'll just print it in reverse (i.e. print "54321" when the user enters "12345"). If you want it to be negative, then you have to either change the sign of the first element being outputted or insert the "-" sign somewhere (it'll print "-54321" when the user enters "12345").