
typedef struct {
    char *name;
    char *val;
} entry;

typedef struct 
{
     char *perg;
     char *val;
     char *descr;
} resp;

/* ---------------------------------------------------------------
   FUNCAO....: aux_avalia
   --------------------------------------------------------------- */

avalia_aux(entry *entries,resp *resposta,int m)

{
  int tot=0,correta=0,x=0;
  int nota=0;
  char *nota1="";

printf("<h1>Resultado da Avalia&ccedil;&atilde;o</h1>");

for(x=0;x<=m;x++)
{
  tot++;
  if(!strcmp(entries[x].val,resposta[x].val))
	{
	printf("<hr><h2>Quest&atilde;o %i : Correta. </h2><p>", x+1);
	correta++;
	}
 else
	{ 	
	printf("<hr><h2>Quest&atilde;o %i : Incorreta. </h2><p>", x+1);
	}

printf("<b>Pergunta:</b> %s <p>",resposta[x].perg);
printf("<b>Resposta correta:</b> %s <p>",resposta[x].descr);
 }
nota = (correta*100)/tot;
if(nota > 80)
	nota1="A";
else if(nota <= 80 && nota > 60)
	nota1 = "B";
     else if(nota <= 60 && nota > 40)
	     nota1 = "C";
          else if(nota <= 40 && nota > 20)
	          nota1= "D";
               else nota1 = "E";
  

printf("<hr><h3>Total de quest&otilde;es: %i</h3>",tot);
printf("<h3>Quest&otilde;es corretas: %i</h3>",correta);
printf("<h3>Porcentagem de acerto: %i %%</h3>",nota);
printf("<h3>Nota: %s</h3>",nota1);

}
