How do i print all the expressions

my code would give just one output
#include
#include
using namespace std;
void go(string s,int open,int close,int pos,int n)
{
if(n==0)
cout<<""<<endl;
if(pos==2*n)
{
if(open==close)
cout<<s<<endl;
else
return;
}
if(open>close)
{
go(s+")",open,close+1,pos+1,n);
}
else if(open<n)
go(s+"(",open+1,close,pos+1,n);

}
int main() {
string s="(";
int open=1;
int close=0;
int pos=1;
int n;
cin>>n;
go(s,open,close,pos,n);
return 0;
}

https://ide.codingblocks.com/s/220403 is my code

@sshreya2912
if(open<n)
This should not be an else-if but rather an independent if.

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.