everytime i run my code run error is occurred.
what is the main reason for this and how can it be resolved.
Run-error is occurred again and again
this is the code and run error is occurring.
#include
#include
#include
#include
using namespace std;
int mycompare(string x, string y){
string xy= x.append(y);
string yx= y.append(x);
return xy.compare(yx) > 0 ? 1: 1;
}
void printlargest(vector arr, int n ){
sort(arr.begin(), arr.end(), mycompare);
for(int i=0; i<n ; i++)
cout<<arr[i];
cout<<endl;
}
int main(){
int t;
vector arr;
string temp;
long long n;
cin>>t;
while(t--){
cin>>n;
for(int i=0;i<n;i++){
cin>>temp;
arr.push_back(temp);
}
printlargest(arr , n);
}
return 0;
}