What is wrong in my code?

Here is my code for the problem ’ Form Biggest Number ':

#include
#include<math.h>
#include
using namespace std;

bool compare(int n1,int n2) {
int n1Digits = 0;
int temp = n1;
while(temp>0) {
n1Digits++;
temp /= 10;
}
int n2Digits = 0;
temp = n2;
while(temp>0) {
n2Digits++;
temp /= 10;
}
int num1 = n1pow(10,n2Digits) + n2;
int num2 = n2
pow(10,n1Digits) + n1;
return (num1>num2)?0:1;
}

int main() {
int t;
cin>>t;
while(t>0) {
int n;
cin>>n;
int *input = new int[n];
for(int i=0;i<n;i++) {
cin>>input[i];
}
sort(input,input+n,compare);
for(int i=0;i<n;i++) {
cout<<input[i];
}
cout<<endl;
delete [] input;
t–;
}
return 0;
}

Please tell me what am i doing wrong
I am only getting one test case correct

Hi @HemantKumar
First of all when you are appending two numbers n1 and n2 then data type of num1 and num2 should be long long. And in the return statement when num1>num2 then your should return 1, so correct return statement should be like :

return (num1>num2)?1:0;

Here is your corrected code :

If your doubt is clear then mark it as resolved.