Can u tell me what is wrong with my code

#include
#include
using namespace std;
int compare(int a,int b){
return a>b;
}
void printlargest(int arr[],int n){
sort(arr,arr+n,compare);
for(int i=0;i<n;i++){
cout<<arr[i];
}
}
int main(){
int t,n;
cin>>t;
cin>>n;
int arr[10000];
for(int i=0;i<n;i++){
cin>>arr[i];
}
printlargest(arr,n);
return 0;
}

Hello @apoorvsin t is the number of test cases
so you have to handle it in the way that if there are multiple test cases then you should print the result for everyresult.
int t;
cin>>t;
while(t–){
//your code goes here;
}
i have corrected your code and now it is printing the correct result.


if you have any doubt you can ask here;
Happy Learning!!

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.