calculate all possibileties
my probleme is I want it to calculate all possibileties for example
the String "AB"
I want the input to be like this :
AA
AB
BA
BB
etc..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string txt="AB" ;
string container ="";
int i =0 ;
fu:
if (container.length()==2)
{
cout << container<<endl;
if (container.length()==2)
{
goto fu;
}
}
else
{
for ( i ;i<2;i++)
{
string old = txt;
container += txt.at(i);
goto fu;
old = txt;
}
}
system("pause");
}
|
Topic archived. No new replies allowed.