No output it is showing in target sum triplets

#include
#include

using namespace std;
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int t;
cin>>t;
sort(a,a+n);
for(int i=0;i<n;i++)
{
int l=i+1;
int r=n-1;
while(l<r)
{
if(a[l]+a[r]+a[i]==t)
{
cout<<a[i]<<", “<<a[l]<<” and "<<a[r]<<endl;
l++; r–;
}
else if(t>a[l]+a[r]+a[i]) r–;
else if(t<a[l]+a[r]+a[i]) l++;

	}
}
return 0;

}

@hg11110000 please save your code on ide.codingblocks.com and share the link.

@hg11110000 hey https://ide.codingblocks.com/s/202456
I made a small change in the conditions at line 24, and 25
It is working now.

Please mark your doubt as resolved if you are satisfied.