Code gives correct answer with the example case but shows all test cases fail when submitting

You are provided an array of numbers. You need to arrange them in a way that yields the largest value.

Input Format
First line contains integer t which is number of test case.
For each test case, you are given a single integer n in the first line which is the size of array A[] and next line contains n space separated integers denoting the elements of the array A .

Constraints
1<=t<=100

1<=m<=100

1<=A[i]<=10^5

Output Format
Print the largest value.

Sample Input
1
4
54 546 548 60
Sample Output
6054854654
Explanation
Upon rearranging the elements of the array , 6054854654 is the largest possible number that can be generated.

i wrote the code
#include
#include
#include
using namespace std;

void largest(){
int a[1000],x;
cin>>x;
for(int i = 0 ; i<x ; i++){
int ele;
cin>>ele;
a[i]=ele;
}

for(int i = 0 ; i<x ; i++){
	for(int j = i+1 ; j<x ; j++){
		float ele1=a[i],ele2=a[j];
		while(ele1/10.0>=1){
			ele1=ele1/10.0;
		}
		while(ele2/10.0>=1){
			ele2=ele2/10.0;
		}
		if(ele2>ele1){
			swap(a[i],a[j]);
		}
	}
}
for(int i = 0 ; i<x ; i++){
	cout<<a[i];
}
cout<<endl;

}

int main(){
int n;
cin>>n;
for(int i = 0 ; i<n ; i++){
largest();
}

return 0;

}

when i build the program on the site it gives me the correct answers for the test case but when i submit it it shows that all test cases are wrong can you please help me.

hi @aryangupta0419_07d1ee3bb01e733f,
have you completed sorting and comparators?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

i have done sorting but not comparators the question comes in the array section

@aryangupta0419_07d1ee3bb01e733f please cover that first as this will be done be that concept