Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void increver_aluno(List_aluno_node *headaluno,List_exame_node *headexame){ /*introduzir as epocas*/
- List_aluno_node temp,tempa;
- List_exame_node temp1,conta;
- List_salas se;
- ListApontAlunos headah;
- ListApontExames headeh;
- List_salas salas;
- salas=malloc(sizeof(Salas_exame));
- int inscritos=0,nexames=0,flag=1;
- headeh=malloc(sizeof(NoApontExames));
- headah=malloc(sizeof(NoApontAluno));
- int i=0,num,n;
- char exam[100];
- if(*headaluno==NULL){
- printf("Não ha alunos inscritos\n");
- return;
- }
- if(*headexame==NULL){
- printf("Não ha exames criados\n");
- return;
- }
- printf("Qual o numero do aluno que pretende inscrever?\n");
- scanf("%d",&num);
- temp=*headaluno;
- while((temp->numero)!=num){
- temp=temp->next;
- if((temp->next==NULL) && (temp->numero!=num)){
- printf("O numero nao existe\n");
- }
- }
- headah->aluno=temp;
- headah->next=NULL;
- tempa=temp;
- fflush(stdin);
- printf("Qual o exame em que pretende inscrever o aluno?\n");
- fgets(exam,100,stdin);
- printf("Qual a epoca?");
- scanf("%d",&n);
- temp1=*headexame;
- while(strcmp((temp1->disciplina)->nome,exam)!=0 && (temp1->epoca!=n)){
- temp1=temp1->next;
- if((temp1->next==NULL) && (strcmp((temp1->disciplina)->nome,exam))!=0 && (temp1->epoca!=n)){
- printf("O exame nao existe\n");
- }
- }
- headeh->exame=temp1;
- headeh->next=NULL;
- if((temp->regime==1)&&(temp1->epoca==3)){
- printf("Nao pode inscrever o aluno nessa fase\n");
- return;
- }
- else{
- if((temp->exames)==NULL){
- temp->exames=headeh;
- temp->nexames=1;
- }
- else{
- while((temp->exames)!=NULL){
- temp->exames=temp->exames->next;
- nexames++;
- }
- nexames++;
- temp->nexames=nexames;
- temp->exames=headeh;
- }
- if((temp1->alunos)==NULL){
- temp1->alunos=headah;
- temp1->inscritos=1;
- }
- else{
- while((temp1->alunos)!=NULL){
- temp1->alunos=temp1->alunos->next;
- inscritos++;
- }
- inscritos++;
- temp1->alunos=headah;
- temp1->inscritos=inscritos;
- }
- }
- salas=temp1->ssala;
- int contador=0;
- if((temp1->inscritos%30 != 0) && (temp1->inscritos >30)){
- int auxiliar = temp1->inscritos;
- auxiliar-=30;
- contador++;
- while((auxiliar%30!=0) && (auxiliar>30)){
- auxiliar-=30;
- contador++;
- }
- if(contador>temp1->sala){
- while(flag){
- int auxiliar2 = contador - temp1->sala;
- int sala_proposta;
- printf("As salas sao insuficientes para o numero de alunos, por favor requisite mais %d sala(s).\n Qual e a sala?\n ",contador );
- scanf("%d",&sala_proposta);
- int confirmar = confirmar_sala(&headexame,sala_proposta,temp1);
- salas->next=NULL;
- salas->numero=sala_proposta;
- if(confirmar==0)
- printf("A sala nao se encontra disponivel, escolha outra.");
- else if(confirmar==1){
- while(temp1->ssala->next==NULL)
- temp1->ssala=temp1->ssala->next;
- temp1->ssala->next=salas;
- printf("A sala foi reservada.");
- flag =0;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement