Pure Programmer
Blue Matrix

Cluster Map

Project: Sign Function

Write a function that takes an integer and computes the sign of the value. The function should return -1 if the argument is negative, +1 if it is positive and 0 if it is zero.

$ g++ -std=c++17 SignFunction.cpp -o SignFunction -lfmt $ ./SignFunction sign(5) : 1 sign(-5) : -1 sign(0) : 0