Form biggest no


Why is this code not working?

Hello @tanyaa.sood,

  1. There is a problem in your compare function:
    x.append(y) will add y after x thus changing the string x.
    so, y.append(x) is actually y.append(xy).
    Problem:
    append makes changes to the string itself.
    Suggestion:
    Try to print x before and after the append statement inside the compare function.
    Solution:
    You ‘+’ operator as it does not make any changes to x.
    ‘+’ will rather return a string appending y after x and vice-a-versa.

I have corrected your code:

Hope, this would help.
Give a like if you are satisfied.

https://ide.codingblocks.com/s/213554 This code is still not working.

Hello @tanyaa.sood,

There is one more mistake in your code:


Refer to the comments.

Hope, this would help.

Hi @tanyaa.sood,
in dis code if u want to take input using cin>>arr[i], u should initialise the size of vector at the time of declaration.
otherwise u should use arr.push_back(s).
I have updated ur code. Refer to dis for more help.
https://ide.codingblocks.com/s/213591
Hope dis helps.
If something is still not clear, feel free to post ur doubt here.