Not able to find the error for the testcases

#include
#include
using namespace std;
bool compare(int arr,int n)
{
return arr<n;
}
int main()
{
int n,i,j;
cin>>n;
int arr[1000];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr,arr+n,compare);
int ts;
cin>>ts;
i=0;
j=sizeof(arr)/sizeof(int)-1;
while(i<j)
{
long int cs=arr[i]+arr[j];
if(cs<ts)
{
i++;
}
else if(cs==ts)
{
cout<<arr[i]<<“and”<<arr[j]<<endl;
i++;
j–;
}
else if(cs>ts)
{
j–;
}
}
return 0;
}

Please save your code on ide.codingblocks.com and then share its link.

Check the pattern of output in the sample case…it must match exactly with your output…include the spaces if there in the sample output

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.

Hey @divyanshnigam1612
How can I help you ?

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.