B
bejiz
Hello,
I would like to make a vector which can store vectors within. It is
for finding the permutations of some numbers. I thought it would be
easy to write some line of code to do this, but apparently, there is a
problem for reading the vector within a vector.
Here is my code. I have added some lines for printing words so that I
could guess where the problem is:
#include<iostream>
#include<vector>
using namespace std;
typedef vector<double>vect;
typedef vector<vect>matr;
matr permute(vect A)
{
for(double v = 1; v <= 3; v++)A.push_back(v);cout<<"az";
matr B; vect b;
for(int i = 0; i < 3; i++)
{cout << "ezr\n";
for(int j = 0; j < 3; i++)
{
cout<<"iz";
b.push_back(A);b.push_back(A[j]);
if(j!=i) B.push_back(b);else cout << "er";
cout<<"uz\n";b.clear();
vect H = B.at(i);
cout<<"er";
vect G = B.at(i+1);
}
}
return B;
}
int main()
{
vect Z;
permute(Z);
}
Thanks for some help.
I would like to make a vector which can store vectors within. It is
for finding the permutations of some numbers. I thought it would be
easy to write some line of code to do this, but apparently, there is a
problem for reading the vector within a vector.
Here is my code. I have added some lines for printing words so that I
could guess where the problem is:
#include<iostream>
#include<vector>
using namespace std;
typedef vector<double>vect;
typedef vector<vect>matr;
matr permute(vect A)
{
for(double v = 1; v <= 3; v++)A.push_back(v);cout<<"az";
matr B; vect b;
for(int i = 0; i < 3; i++)
{cout << "ezr\n";
for(int j = 0; j < 3; i++)
{
cout<<"iz";
b.push_back(A);b.push_back(A[j]);
if(j!=i) B.push_back(b);else cout << "er";
cout<<"uz\n";b.clear();
vect H = B.at(i);
cout<<"er";
vect G = B.at(i+1);
}
}
return B;
}
int main()
{
vect Z;
permute(Z);
}
Thanks for some help.