Ad
  • Custom User Avatar

    Undefined behavior should not be best practice, nor clever.

  • Custom User Avatar

    Idk what you're doing but the C++ version works fine.

  • Custom User Avatar

    Yep, does not compile whatever...:

    main.cpp:19:22: error: no matching function for call to 'DetermineBase'
            Assert::That(DetermineBase(log), EqualsWithDelta(M_E, 1e-12));
                         ^~~~~~~~~~~~~
    main.cpp:8:8: note: candidate function not viable: no overload of 'log' matching 'std::function<double (double)>' for 1st argument
    double DetermineBase(std::function<double(double)> func){
           ^
    main.cpp:20:22: error: no matching function for call to 'DetermineBase'
            Assert::That(DetermineBase(log10), EqualsWithDelta(10, 1e-12));
                         ^~~~~~~~~~~~~
    main.cpp:8:8: note: candidate function not viable: no overload of 'log10' matching 'std::function<double (double)>' for 1st argument
    double DetermineBase(std::function<double(double)> func){
           ^
    main.cpp:21:22: error: no matching function for call to 'DetermineBase'
            Assert::That(DetermineBase(log2), EqualsWithDelta(2, 1e-12));
                         ^~~~~~~~~~~~~
    main.cpp:8:8: note: candidate function not viable: no overload of 'log2' matching 'std::function<double (double)>' for 1st argument
    double DetermineBase(std::function<double(double)> func){
           ^
    1 warning and 3 errors generated.
    
  • Custom User Avatar
  • Custom User Avatar

    good point

  • Custom User Avatar

    I think it's undefined behaviour to modify a value more than once between sequence points.
    see https://port70.net/~nsz/c/c11/n1570.html#6.5p3

  • Custom User Avatar

    Does not compile even with solution. C++

  • Custom User Avatar
  • Custom User Avatar

    I've edited how k was generated, it should be fixed now for both C and C++. Mark as resolved if it is.

  • Custom User Avatar

    k should be less than n because the balls are numbered from 0 to n - 1.
    C++ has also the same problem.

  • Custom User Avatar

    Where does it say i have to return -2 if k and n are equal?

    Please fix the c version

  • Custom User Avatar

    @danderle ..

    • That's what i've bet , Unfortunately :disappointed: :disappointed:
    • The C Translator has been inactive for pretty long time , I've mentioned him 1 month ago Check Here, also (You can see Below :point_down: :point_down: , another issue raised concerning C Translation hasn't been resolved Yet ) :disappointed:
    • So if you could translate it into C Language and Leave me a link with it so i can approve and overwrite the current bugged one I'll be grateful :blush: .. Tuned .. Regards .. Zizou
  • Custom User Avatar
  • Custom User Avatar

    @danderle ..

    • Well , thanks Bro for pointing out , I Think You've attempt the kata either in C or C++ but the odd thing is Both of them has been completed 16 and 42 Times Without an issue raised :exclamation: :exclamation:
    • So for more help , Could you please name the language that you've attempt in letting me mention its translatoe to fix the problem
    • I'm tuned to hear your feedback :blush: .. Hope you all the best .. Regards .. Zizou
  • Custom User Avatar

    Getting a 0 as Input

  • Loading more items...