home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / basic / d_array.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  437 b   |  29 lines

  1. #include <LEDA/d_array.h>
  2.  
  3. declare2(d_array,string,string)
  4.  
  5.  
  6. void print(d_array(string,string) A)
  7. { // makes a copy A
  8.   string s;
  9.   forall_defined(s,A) cout << s << "  " << A[s] << "\n";
  10. }
  11.  
  12. main()
  13.   d_array(string,string) trans, D;
  14.  
  15.   trans["hello"]  = "hallo";
  16.   trans["world"]  = "Welt";
  17.   trans["book"]   = "Buch";
  18.   trans["coffee"] = "Kaffee";
  19.   trans["hello"]  = "xyz";
  20.  
  21.  
  22.   D = trans;  // makes a copy
  23.  
  24.   print(D);
  25.   newline;
  26.  
  27. }
  28.