Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.00 KB | None | 0 0
  1. void Mastiempo(listaP,int *aux2, datos arr[], int, datos); PROTOTIPO
  2.     case 8:
  3.         system("CLS");
  4.         if(emptyP(listaprioridad)==1){
  5.             printf("Lista Vacia\n");
  6.             system("PAUSE");
  7.         } else{
  8.         resetP(&listaprioridad);
  9.         datos auxiliar;
  10.         while(oosP(listaprioridad)==0 || mostrar_atendido(copyP(listaprioridad))==1)
  11.         {
  12.             forwardP(&listaprioridad);
  13.  
  14.         }
  15.         auxiliar = copyP(listaprioridad);
  16.         arr = (datos*)malloc(sizeof(datos)*contar_total_atendidos(listaprioridad));
  17.         forwardP(&listaprioridad);
  18.         Mastiempo(listaprioridad,&aux2,&arr,n,auxiliar);
  19.  
  20.  
  21.         for(i=0;i<*aux2; i++){
  22.             printf("%s\n",arr[i].nomb);
  23.         }
  24.         system("PAUSE");
  25.         }
  26.         break;
  27.  
  28. FIN MAIN
  29. FUNCION CONTAR TOTAL ATENDIDOS
  30. //* Contar total atendidos *//
  31. int contar_total_atendidos(listaP P){
  32. int i=0;
  33. while(oosP(P)==0){
  34.     i++;
  35. }
  36. return i;
  37. }
  38.  
  39. RECURSIVA
  40. void insertar_no_aten_medico(listaP *P){
  41.     if(emptyP(*P)==1){
  42.         printf("No hay pacientes para asignarle no atendido.\n");
  43.     }
  44.     else {
  45.     resetP(P);
  46. datos auxiliar;
  47. auxiliar = copyP(*P);
  48. modifica_no_atendido(&auxiliar);
  49. noatendido(&auxiliar);
  50. supresP(P);
  51. while(oosP(*P)==0){
  52.     forwardP(P);
  53.  
  54. }
  55. insertP(P,auxiliar);
  56. printf("No atendido insertado con exito.\n");
  57. }
  58. }
  59.  
  60. //* FIN Insertar NO ATENDIDO MEDICO. *//
  61.  
  62. //* Quien espero mas tiempo RECURSIVA*//
  63. void Mastiempo(listaP P,int *aux2,datos arr[],int i, datos auxiliar){
  64. if(oosP(P)==1){
  65.     return;
  66. }
  67. else
  68.  
  69.     if(retorna_resta_horasmin(auxiliar) > retorna_resta_horasmin(copyP(P))){
  70.         arr[i] = auxiliar;
  71.         forwardP(&P);
  72.         *aux2 = *aux2 + 1;
  73.  
  74.     }
  75.     else if(retorna_resta_horasmin(auxiliar) == retorna_resta_horasmin(copyP(P))){
  76.         arr[i+1]= copyP(P);
  77.         *aux2 = *aux2 + 1;
  78.         forwardP(&P);
  79.  
  80.     } else if(retorna_resta_horasmin(auxiliar)< retorna_resta_horasmin(copyP(P))){
  81.         auxiliar = copyP(P);
  82.  
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement