How we handle multiple output

#include
using namespace std;
int main()
{
int a[20],i,n,p,ans=0,q;
cout<<“Enter the limit”;
cin>>n;
cout<<“Enter binary no.”;
for(i=0;i<n;i++){
cin>>a[i];
}
p=1;
for(i=0;i<n;i++)
{
q=a[i]%10;
ans=ans+(qp);
p=p
2;
a[i]=a[i]/10;

}

for(i=0;i<n;i++){
cout<<“binary no.”<<ans;
}
return 0;
}
i want to solve through array but i didn’t find my solution
this is my code but i did not understand how to give multiple output.
but i solve this question from using string.

to handle multiple testcases
you use this

int testcase; cin>>testcase;
    while(testcase--){
   // here write your logic      
    }

you can refer to this code

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.