3 Topics
|
|
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 … |
|
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) |
|
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 … |
The End.