update
This commit is contained in:
@ -356,5 +356,32 @@ const int& permutation::at(const int ind) const
|
||||
return data[ind];
|
||||
}
|
||||
|
||||
void permutation::print(int style)
|
||||
{
|
||||
int I;
|
||||
if(style==0)
|
||||
{
|
||||
printf("{");
|
||||
for(I=0;I<length-1;I++) printf("%d,",data[I]);
|
||||
printf("%d}",data[length-1]);
|
||||
}
|
||||
else if(style==1)
|
||||
{
|
||||
printf("permutation:{");
|
||||
for(I=0;I<length-1;I++) printf("%d,",data[I]);
|
||||
printf("%d}",data[length-1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void test_permutation1()
|
||||
{
|
||||
permutation a = permutation(5);
|
||||
|
||||
a.print(1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}; //end namespace perm
|
||||
}; //end namespace ams
|
||||
@ -6,6 +6,7 @@ int main(int argc, char* argv[])
|
||||
printf("ams c++ permutation library tests.\n");
|
||||
//amsperm1_test_basicperm1();
|
||||
//ams::perm::test_ipermutation1();
|
||||
ams::perm::test_ipermutation2();
|
||||
//ams::perm::test_ipermutation2();
|
||||
ams::perm::test_permutation1();
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user