3 Topics

Member Avatar for
Member Avatar for FelineHazard

Hi guys, I'm learning C++ from a book and I have a question about defining unary operators: In the book I'm working with there's an example, where they define a class called point, and define ++ operator for point *as friend*. here's the example: ~~~ c class point { int …

Member Avatar for FelineHazard
0
212
Member Avatar for Labdabeta

I am really confused as to the purpose of the unary + operator. What in the world does it do? I have tested it and it doesn't return the absolute value. Does it just return the operand? And if so what purpose is it?! (I mainly care about integer types)

Member Avatar for mrnutty
0
294
Member Avatar for TrustyTony

My Python has started to imagine that square root of -1 is 1, so be careful with ** and unary -. [CODE]print (-1**0.5) ## ** binds stronger than unary minus! i=-1 print "Square root of %i is %f" (i,i**0.5) # gives proper error """ Output: -1.0 Traceback (most recent call …

Member Avatar for Skyelher
0
339

The End.