#include using namespace std; // STRUTTURE struct Teatro{ bool** mat; // false=libero; true=occupato int n_file; int n_posti; }; struct elem{ int fila; int posto; elem* pun; }; // FUNZIONI void inizializzaTeatro(Teatro& t, int N, int M){ t.n_file = N<1 ? 1 : N; t.n_posti = M<1 ? 1 : M; t.mat = new bool*[t.n_file]; for(int i=0; it.n_file){ cerr << "Fila non valida" << endl; return false; } if(k<1||k>t.n_posti){ cerr << "Numero posti non valido" << endl; return false; } f--; bool trovato = false; int indice; for(int i=0; i<=t.n_posti-k && !trovato; i++){ trovato=true; indice=i; for(int j=0; jt.n_file){ cerr << "Fila non valida" << endl; return false; } f--; int liberati = 0; for(int j=0; jfila = i+1; p->posto = j+1; p->pun = testa; testa = p; } } } return testa; } void StampaTeatro(Teatro t){ for(int i=0; ipun){ cout << "Fila: " << q->fila << " posto: " << q->posto; if(q->pun != NULL){ cout << " --> "; } } return 0; }