its a test code , i am learning use of stoi()
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include<string>
using namespace std;
int main()
{
int N;
string S,T;
int i,j,A[N],B[N];
cout<<"enter size ";
cin>>N;
cout<<"enter strings ";
cin>>S;
char temp1;
for(i=0;i<N;++i)
{
if(i==0)
{
A[i]=stoi(S,0,2);
}
else
{
temp1=S[i];
S[i]=S[i-1];
S[i-1]=temp1;
A[i] = stoi(S,0,2);
}
}
cout<<"all formations are ";
for(i=0;i<N;++i)
{
cout<<A[i]<<endl;
}
return 0;
}