Setting an int to Infinity in C++

前端 未结 6 1182
终归单人心
终归单人心 2020-12-12 10:28

I have an int a that needs to be equal to \"infinity\". This means that if

int b = anyValue;

a>b is always tru

6条回答
  •  天命终不由人
    2020-12-12 10:57

    You can also use INT_MAX:

    http://www.cplusplus.com/reference/climits/

    it's equivalent to using numeric_limits.

提交回复
热议问题