Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 22nd, 2012  |  syntax: None  |  size: 1.34 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //-----------------------------------------------
  2. void Grupes::Naujas(NaujasSarasas2 & N, double nuo, double iki){
  3.         Grupe *g = p;
  4.         string pavarde, vardas, grupe;
  5.         NaujasSarasas m;
  6.         Studentas2 *d;
  7.         while(g!= NULL){
  8.                 d = g->ImtiSaka();
  9.                 while(d != NULL){
  10.                         if((nuo != d->ImtiDuom().ImtiAtstumas()) && (iki != d->ImtiDuom().ImtiAtstumas())){
  11.                                 m = NaujasSarasas(d->ImtiDuom().ImtiPavarde(), d->ImtiDuom().ImtiVardas(), g->ImtiGrupe());
  12.                                 N.Deti(m);
  13.                         }
  14.                         d = d->ImtiKitas();
  15.                 }
  16.                 g = g->ImtiSekantis();
  17.         }
  18. }
  19. //-----------------------------------------------
  20. void Grupes::Skaiciavimas(const char fv[], double sk){
  21.         Grupe *g = p;
  22.         Studentas2 *d;
  23.         int kiek;
  24.         double k;
  25.         ofstream rf(fv, ios:: app);
  26.         while (g!= NULL){
  27.                 d = g->ImtiSaka();
  28.                 kiek = 0;
  29.                 while (d != NULL){      
  30.                         k = d->ImtiDuom().ImtiAtstumas();
  31.                         if(k < sk){
  32.                                 kiek++;
  33.                         }
  34.                         d = d->ImtiKitas();
  35.                 }
  36.                 g = g->ImtiSekantis();
  37.         }
  38.         rf << "Studentų, gyvenančių mažesniu nei " << sk << "m atstumu yra: " << kiek << endl;
  39.         rf << "————————————————————————————————————————————————————————————————————————————————————" << endl;
  40.         rf.close ();
  41. }
  42. //-----------------------------------------------