What should i do now in this Problem
Code is
#include
#include
using namespace std;
int main() {int n,i;
cin>>n;
int arr[n];
int g=0;
while(g<n)
{
cin>>arr[g];
g++;
}
/for(i=0;i<n;i++)
{
cin>>arr[i];
}/
int target;
cin>>target;
sort(arr,arr+n);
int l=0;
int r=n-1;
while(l<r)
{
if(arr[r]+arr[l]>target)
{
r=r-1;
}
else if (arr[r]+arr[l]==target)
{
cout<<arr[l]<<" and "<<arr[r]<<endl;
l=l+1;
r=r-1;
}
}
return 0;
}