well, *= is certainly an improvement upon the rube goldberg in the OP at least lol
not sure if "0-x" is actually any simpler, but that's the only other thing i can think of.
well, *= is certainly an improvement upon the rube goldberg in the OP at least lol
not sure if "0-x" is actually any simpler, but that's the only other thing i can think of.
x = -x;
Last edited by robwhit; 08-08-2008 at 10:03 AM.
Just saw this post and my quick thought was
Was that what you were trying to convey mats? Given x has been initialized with a signed int variable.Code:cout << "-x = " << ~x+1 << '\n';