How to correctly use Boolean functions?

I’m having trouble with the following assignment, mostly because I don’t understand how a Boolean function works. “Write a function called Divisible that takes in two numbers as parameters. Return True if the first number is evenly divisible (no remainder) by the second number. Otherwise return False. Hint: Use %”

Currently what I have is:

int Divisible()
     int firstNum;
     int secondNum;
     int result;
     cout << "Please enter any integer: ";
     cin >> firstNum;
     cout << "Please enter another integer: ";
     cin >> secondNum;
     result == firstNum%secondNum;

I’m not sure what to do beyond that. I thought I could assign bool = 0 as true but that doesn’t appear to be the case. I’m still very new to C++ so any help would be appreciated.

Leave a Comment