Check out example codes for "bool function in c++". It will help you in understanding the concepts better.

Code Example 1

bool Divisible(int a, int b) {
    int remainder = a % b; // Calculate the remainder of a and b.

    if(remainder == 0) {
        return true; //If the remainder is 0, the numbers are divisible.
    } else {
        return false; // Otherwise, they aren't.
    }
}

Code Example 2

bool Divisible(int a, int b) {
    return !(a % b);
}

Code Example 3

bool Divisible(int a, int b) {
    return (a % b) == 0;
}

Learn ReactJs, React Native from akashmittal.com