Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    It is your rank. The smaller - the better. The highest kyu is 1.

  • Default User Avatar

    Okay, so I don't yet know why your code passes the sample tests. Most importantly, your code does not acheive the actual goal of the kata, and so it really shouldn't pass all the sample tests. It's something curious, never seen anyone write what you did... you put an assertion into your function, I have no idea why:

    bool narcissistic( int ) {
      Assert::That(narcissistic(7), Equals(true));
    }
    

    Regardless, you should definitely learn to read your error messages:

    Your 1st warning reveals control reaches end of non-void function because you do not return a value from your function. You do need to return a Boolean value.

    Your second warning reveals: all paths through this function will call itself because your function contains a call to itself with no exception (exit condition), resulting in infinite recursion.

    Also, take note that this function receives a value, but your function declaration only shows the type int without an actual parameter, which is something you removed for some reason.