What is wrong in this code

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t–)
{
int n;
cin >> n;
int a[n];
for (int i=0;i<n;i++)
{
cin >> a[i];
}
int m;
cin >> m;

	sort(a,a+n);
	
	int x=0;
	int y=n-1;
	int f=0;
	int s=0;
	while(x<y)
	{
	  if(a[x]+a[y]==m)
	  {
	    f=a[x];
	    s=a[y];
	    x++;
	    y--;
	  }
	  else
	  if(a[x]+a[y]>m)
	  {
	    y--;
	  }
	  else
	  if(a[x]+a[y]<m)
	  {
	    x++;
	  }
	}
	
	cout<<"Deepak should buy roses whose prices are "<<f<<" and "<<s<<" ."<<endl;

	}
	
}