I know that C++ provides us with a ceil function. For practice, I was wondering how can we implement the ceil function in C++. The signature of the method is public static
Here's one that works with negative numbers:
int ceil(float num) { int inum = (int)num; if (num < 0 || num == (float)inum) { return inum; } return inum + 1; }