p_dic.c
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 0k
Development Platform:

MultiPlatform

  1. #include <LEDA/p_dictionary.h>
  2. #include <LEDA/list.h>
  3. #include <math.h>
  4. typedef p_dictionary<float,string> PDIC;
  5. main()
  6. {
  7.   p_dictionary<float,string> Dic;
  8.   list<PDIC>  L;
  9.   int n = read_int("n = ");
  10.   for(int i = 1; i<n; i++) 
  11.   {  Dic = Dic.insert(sqrt(i),string("sqrt(%d)",i));
  12.      L.append(Dic);
  13.    }
  14.   forall(Dic,L) 
  15.   { p_dic_item it;
  16.     forall_items(it,Dic)  cout << Dic.inf(it) << "=" <<  Dic.key(it) << " ";
  17.     newline;
  18.    }
  19.   return 0;
  20. }