rendered paste body#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Nodo{
char nome;
int temperatura;
struct Nodo *prox;
}Nodo;
Nodo **inicioNormal,*inicio,**inicioPrioridade;
// FUNÇÕES //
void Cadastrar(Nodo **inicioNormal);
void filaPrioridade( Nodo **inicioPrioridade,char nom,int temp);
void filaNormal(Nodo **inicioNormal,char nom,int temp);
void atendimento();
void menu(Nodo **inicio);
// função para pegar os dados do pacient
int main()
{
inicioNormal = NULL;
menu(&(inicio));
return 0;
}
void Cadastrar(Nodo **inicioNormal)
{
char nom,nom1;
int temp,temp1;
printf ("\n Nome do Cliente\n");
scanf("%s", & nom);
printf("\n Informe a temperatura\n");
scanf("%d", & temp);
if (temp <38)
filaNormal(&(*inicioNormal),nom,temp);
else filaPrioridade(&(*inicioPrioridade),nom1,temp1);
}
void filaNormal(Nodo **inicioNormal,char nom,int temp)
{ Nodo *novo, *fimNormal;
novo = (Nodo*)malloc(sizeof(Nodo));
if(novo == NULL) exit(1);
novo->nome =nom;
novo->temperatura = temp;
novo->prox=NULL;
if(*inicioNormal == NULL)
*inicioNormal = novo;
else {
fimNormal=*inicioNormal;
while( fimNormal->prox != NULL){
fimNormal = fimNormal->prox;}
fimNormal->prox = novo;
}
}
void filaPrioridade(Nodo **inicioPrioridade,char nom1,int temp1)
{ Nodo *novo, *fimPrioridade;
novo = (Nodo*)malloc(sizeof(Nodo));
if(novo == NULL) exit(1);
novo->nome =nom1;
novo->temperatura = temp1;
novo->prox=NULL;
if(*inicioPrioridade == NULL)
*inicioPrioridade = novo;
else {
fimPrioridade=*inicioPrioridade;
while( fimPrioridade->prox != NULL){
fimPrioridade = fimPrioridade->prox;}
fimPrioridade->prox = novo;
}
}
void menu(Nodo **inicio)
{ int op;
printf("\n1. Cadastro");
printf("\n2. Sair");
printf("\n\nDigite sua escolha ");
scanf("%d",&op);
switch (op) {
case 1: printf("\ncadastro");
Cadastrar(&(*inicio));
break;
case 2:printf("\n Sair");
exit(1);
break;
default: printf("\n OPCAO INVALIDA\n");
system("PAUSE");
}
menu(&(*inicio));
}
void imprimir(Nodo *inicioNormal)
{ printf("\n\n Paciente\n\n");
while( inicioNormal != NULL){
printf(" %d ", inicioNormal->nome);
inicio = inicio->prox;}
printf("\n\n");
}