Listing 4. Database Query Macro

//----------- begin find.C
void find(int begin_age = 0, int end_age = 10)
{
 gSystem->Load("Person.so");
 TFile *f = new TFile("test.root");
 TIter next(f->GetListOfKeys());
 TKey *key;
 while (key = (TKey*)next()) {
 Person *t = (Person *) key->Read();
 if (t->get_age() >= begin_age && t->get_age() <=
   end_age) {
 printf("age = %d, height = %f\n",
   t
 }
 delete t;
 }
}
//----------- end find.C