Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct job *n_job(int x, struct PC *pc){
- struct job *e = (struct job *)malloc(sizeof(struct job));
- e->nome = x;
- e->ID = pc ->ID;
- e->next = NULL;
- return e;
- };
- void delete_job(struct PC *pc, int ID, int nome){
- struct job *curr, *prec = NULL;
- struct PC *app = pc;
- if(pc != NULL)
- {
- while(app != NULL && app->ID != ID)
- app = app->next;
- curr = pc -> lista;
- while(curr != NULL && curr -> nome != nome){
- prec = curr;
- curr = curr ->next;
- }
- if(curr == NULL)
- printf("Il job cercato non c'e'!\n");
- else{
- if(prec == NULL)
- free(curr);
- else{
- prec->next = curr ->next;
- free(curr);
- }
- }
- }
- else
- printf("La lista dei pc e' vuota!\n\n");
- }
- struct PC *nuova_lista_pc(int n){
- struct PC *e = (struct PC *)malloc(sizeof(struct PC));
- if(n > 0){
- e->ID = n;
- e->lista = NULL;
- n--;
- e->next = nuova_lista_pc(n);
- }
- else
- e = NULL;
- return e;
- };
- int numero_pc(){
- int n;
- printf("Quanti pc vuoi?\n\n ");
- do{
- printf("> ");
- scanf("%d", &n);
- if(n < 0)
- printf("Inserisci un numero maggiore o uguale a 0! Riprova:\n\n");
- }while(n < 0);
- return n;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement