示例#1
0
int main(int argc,char **argv)
{
   int_type n;
   int_type temp;
   char lenk_fact[20];
   char lenk_perma[20];   char lenk_permb[20];
   char lenk_permc[20];   char lenk_permd[20];
   char lenk_comba[20];   char lenk_combb[20];
   char lenk_combc[20];   char lenk_combd[20];
   /*==================================================================*/
   if (argc>1) freopen(argv[1],"w",stdout);
   else freopen("factchek.out","w",stdout);
   /*==================================================================*/
   printf(" n        n!          comb(n,n)     comb(n,n-1)    comb(n,n-2)    comb(n,n-3)\n");
   printf("---  -------------  -------------  -------------  -------------  -------------\n");
   for (n=0;n<21;++n){
      DO_ENK(ifact(n),lenk_fact);
      DO_ENK(xcomb(n,n),lenk_comba);
      DO_ENK(xcomb(n,(int_type) (n-1)),lenk_combb);
      DO_ENK(xcomb(n,(int_type) (n-2)),lenk_combc);
      DO_ENK(xcomb(n,(int_type) (n-3)),lenk_combd);
      printf("%3d%s%s%s%s%s\n",
             (int) n,lenk_fact,lenk_comba,lenk_combb,lenk_combc,lenk_combd);}
   /*==================================================================*/
   printf(" n        n!          comb(n,0)      comb(n,1)      comb(n,2)      comb(n,3)\n");
   printf("---  -------------  -------------  -------------  -------------  -------------\n");
   for (n=0;n<21;++n){
      DO_ENK(ifact(n),lenk_fact);
      DO_ENK(xcomb(n,(int_type) 0),lenk_comba);
      DO_ENK(xcomb(n,(int_type) 1),lenk_combb);
      DO_ENK(xcomb(n,(int_type) 2),lenk_combc);
      DO_ENK(xcomb(n,(int_type) 3),lenk_combd);
      printf("%3d%s%s%s%s%s\n",
             (int) n,lenk_fact,lenk_comba,lenk_combb,lenk_combc,lenk_combd);}
   /*==================================================================*/
   printf(" n        n!          perm(n,n)     perm(n,n-1)    perm(n,n-2)    perm(n,n-3)\n");
   printf("---  -------------  -------------  -------------  -------------  -------------\n");
   for (n=0;n<21;++n){
      DO_ENK(ifact(n),lenk_fact);
      DO_ENK(xperm(n,n),lenk_perma);
      DO_ENK(xperm(n,(int_type) (n-1)),lenk_permb);
      DO_ENK(xperm(n,(int_type) (n-2)),lenk_permc);
      DO_ENK(xperm(n,(int_type) (n-3)),lenk_permd);
      printf("%3d%s%s%s%s%s\n",
             (int) n,lenk_fact,lenk_perma,lenk_permb,lenk_permc,lenk_permd);}
   /*==================================================================*/
   printf(" n        n!          perm(n,0)      perm(n,1)      perm(n,2)      perm(n,3)\n");
   printf("---  -------------  -------------  -------------  -------------  -------------\n");
   for (n=0;n<21;++n){
      DO_ENK(ifact(n),lenk_fact);
      DO_ENK(xperm(n,(int_type) 0),lenk_perma);
      DO_ENK(xperm(n,(int_type) 1),lenk_permb);
      DO_ENK(xperm(n,(int_type) 2),lenk_permc);
      DO_ENK(xperm(n,(int_type) 3),lenk_permd);
      printf("%3d%s%s%s%s%s\n",
             (int) n,lenk_fact,lenk_perma,lenk_permb,lenk_permc,lenk_permd);}
   /*==================================================================*/
}
 ecs_type create_factory(gram_type& grammar,sbmt::lattice_tree const& lat)
 {
     boost::shared_ptr<info_factory_type> 
         ifact(new info_factory_type(constructor.construct<N>(grammar,grammar_properties().property_map())));
         
     return ecs_type(boost::in_place<edge_factory_type>(ifact));
 }
示例#3
0
文件: haze.cpp 项目: garinh/cs
csPtr<iMeshObjectFactory> csHazeMeshObjectType::NewFactory ()
{
  csHazeMeshObjectFactory* cm = new csHazeMeshObjectFactory (this);
  csRef<iMeshObjectFactory> ifact (
  	scfQueryInterface<iMeshObjectFactory> (cm));
  cm->DecRef ();
  return csPtr<iMeshObjectFactory> (ifact);
}