The code I wrote works fine on vscode and sublime but here it shows this error.
can you please help me figure it out what should I modify so the code works
#include
#include<math.h>
#include
#include
#include
using namespace std;
int len(int a){
int length = 1;
int i=1;
while(i>0){
a = a/10;
if(a!=0){
length++;
}
else if(a==0){
i–;
}
}
return length;
}
bool compare(int a,int b){
int x,y,aa,bb;
x = pow(10,len(a)-1);
y = pow(10,len(b)-1);
aa = a;
bb = b;
aa = aa/x;
bb = bb/y;
if(aa!=bb){
return aa>bb;
}
else if(aa==bb){
while(aa==bb){
aa = a;
bb = b;
}
return aa>bb;
}
}
int main(){
int a[100];
int b[100];
int t,n,num,g,h,i,j,k,l;
cin>>t;
for(g=0;g<t;g++){
cin>>n;
for(i=0;i<n;i++){
cin>>num;
a[i] = num;
b[i] = num;
}
sort(b,b+n,compare);
for(i=0;i<n;i++){
cout<<b[i];
}
cout<<endl;
}
return 0;
}