Пример #1
0
void BST < Filler > :: CreateNODO ( Filler X ){
    NODO < Filler > * Nuovo;
    Nuovo = new NODO < Filler >;
    if ( Nuovo ){
        Nuovo->SetElem ( X );
        //Nuovo->PrintNODO ();
        Inserimento ( GetRoot (), Nuovo );
        std :: cout << "Nodo Allocato con Successo" << std :: endl << std :: endl;
    }
    else{
        std :: cout << "IMPOSSIBILE ALLOCARE IL NODO!!!" << std :: endl << std :: endl;
    }
}
Пример #2
0
int main(){
  Nodo *head=NULL;
  int valore;
  FILE *src=fopen("base", "r");

  while(fscanf(src, "%d", &valore) != EOF)
    Inserimento(&head, valore);

  Modifica(head);

  while(head){
    printf("%3d ", head->valore);
    head=head->next;
  }

  __fpurge(stdin);
  getchar();
}
Пример #3
0
int main(int argc, char *argv[]){
  struct Studente *aula;
  int riemp, mat, i;

  do{
    printf("Quanti studenti vuoi inserire: ");
    scanf("%d", &riemp);
  }while(riemp<1);
  aula=(struct Studente*) calloc(riemp, sizeof(struct Studente));
  Inserimento(riemp, aula);

  do{
    printf("Inserisci la matricola dello studente da cercare: ");
    scanf("%d", &mat);

    if((i=Search(aula, riemp, mat))>=0)
      printf("lo studente %s %s nato il %s ha sostenuto %d esami.\n", aula[i].nome, aula[i].cognome, aula[i].nascita, aula[i].esami);
    else
      printf("Studente non trovato.\n");
    }while(1);
  __fpurge(stdin);
  getchar();
}