Yeah, I picked up an old C++ textbook about a week ago and it seems pretty interesting. Using A Computer Science Tapestry by Astrachan. Anyway, I need help with the boolean, IsPerfect. I've gotten this far, but I just can't seem to fix it up.
Note: I am basing this off the textbook's example of IfPrime, so any help would be appreciated. Also running a second cpp file for the purpose of testing this boolean. Thank you.Code:bool IsPerfect(int n) { int sum = 0; int x; int divisor; x = n; while(x > 0) { divisor = x; if(n % divisor == 0) { sum += divisor; } x--; } if(sum == n) { return true; } else { return false; } }