Calling a boolean from methods

Having some trouble calling a boolean. whenever I try to call the method in the main I never get a return. Anyone have a go at it?
here is the method
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  bool piggybank::isEqual(piggybank p2)
{
    if(calcpiggyBankValue() == p2.calcpiggyBankValue())
        return true;
    else
        return false;
}



bool piggybank::isLessthan(piggybank p2)
{
    
    
    if(calcpiggyBankValue() < p2.calcpiggyBankValue())
        return true;
    else
        return false;
    
}







bool piggybank::isGreaterthan(piggybank p2)
{
    if(calcpiggyBankValue() > p2.calcpiggyBankValue())
        return true;
    else
        return false;
}


here is the calling in the int main():
1
2
3
bank5.isEqual(bank6);
    bank5.isGreaterthan(bank6);
    bank5.isLessthan(bank6);
Are you actually getting the return value or doing anything with it? How do you know that it isn't returning? For example:
1
2
3
4
bool isEqual = bank5.isEqual(bank6);
if (isEqual) {
    // ...
}

Of course, you don't need to store it in the variable, you could just call it directly inside the if statement, but I don't know exactly what it is you want to do with the information so I left it as is.
What does calcpiggyBankValue() do? Is that function hanging?
Topic archived. No new replies allowed.