home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pat_hash.c < prev    next >
C/C++ Source or Header  |  1995-12-29  |  3KB  |  78 lines

  1. #include <iostream.h>
  2. #include <iglobals.h>
  3. #include <pat_hash.h>
  4. #include <ihshks.h>
  5.  
  6. typedef IHashKeySet  <Patient , NameBirthSex>  PatientSet;
  7.  
  8.  
  9. ostream & operator << ( ostream & sout, PatientSet patients)
  10.  
  11.    {
  12.    PatientSet::Cursor patientsCursor(patients);
  13.  
  14.    IDate::YearFormat yearFormat=IDate::yyyy;
  15.  
  16.    for (patientsCursor.setToFirst();patientsCursor.isValid();patientsCursor.setToNext() )
  17.      {
  18.      Patient printElement = patients.elementAt(patientsCursor);
  19.  
  20.      cout << "Patient: " <<  printElement.patientName()
  21.           << ",  " << printElement.patientBirth().asString(yearFormat)
  22.           << ",  " << printElement.patientSex()
  23.           << ",  " << printElement.patientDiagnosis() << endl;
  24.      } /* endfor */
  25.  
  26.    return sout;
  27.    }
  28.  
  29.  
  30.  
  31. int main ()
  32. {
  33.   PatientSet patients;
  34.  
  35.   Patient p1("Annnie Anderson", IDate(IDate::January, 17, 1970), "female", " ");
  36.   Patient p2("Bernie Butcher", IDate(IDate::February, 19, 1934), "male", " ");
  37.   Patient p3("Chris Capone", IDate(IDate::March, 12, 1924), "male", " ");
  38.   Patient p4("Dave Dudley", IDate(IDate::April, 16, 1943), "male", " ");
  39.   Patient p5("Elton Edwards", IDate(IDate::May, 12, 1960), "male", " ");
  40.   Patient p6("Fanny Ferguson", IDate(IDate::June, 15, 1959), "female", " ");
  41.   Patient p7("Greg Gigley", IDate(IDate::July, 22, 1936), "male", " ");
  42.   Patient p8("Helen Hatchet", IDate(IDate::August, 30, 1940), "female", " ");
  43.   Patient p9("Leslie Lonesome", IDate(IDate::June, 1, 1969), "female", " ");
  44.   Patient p10("Leslie Lonesome", IDate(IDate::June, 1, 1969), "male", " ");
  45.  
  46.   p1.setPatientDiagnosis("fever");
  47.   p2.setPatientDiagnosis("sickness");
  48.   p3.setPatientDiagnosis("influenza");
  49.   p4.setPatientDiagnosis("headache");
  50.   p5.setPatientDiagnosis("indigestion");
  51.   p6.setPatientDiagnosis("catarrh");
  52.   p7.setPatientDiagnosis("laziness");
  53.   p8.setPatientDiagnosis("appendicitis");
  54.   p9.setPatientDiagnosis("stage-fright");
  55.   p10.setPatientDiagnosis("hayfever");
  56.  
  57.  
  58.         patients.add(p1);
  59.         patients.add(p2);
  60.         patients.add(p3);
  61.         patients.add(p4);
  62.         patients.add(p5);
  63.         patients.add(p6);
  64.         patients.add(p7);
  65.         patients.add(p8);
  66.         patients.add(p9);
  67.         patients.add(p10);
  68.  
  69.         cout << "Printing the original patient collection:"
  70.              << endl
  71.              << "========================================="
  72.              << endl
  73.              << patients
  74.              << endl;
  75.  
  76.         return 0;
  77. }
  78.