How to make a variable of type character receive another in a conditional structure in VisualG?

I'm making an algorithm to show the highest grade and in that highest grade,show the name of the student who took that highest grade. At first everything seems ok, but it is not working. Where's the mistake?

algoritmo "melhor aluno"
var
Quantidade,cont,nota,maior : real
nome,melhor_aluno : caractere
inicio
   Escreval ("==============================")
   Escreval ("    Escola Santa Paciencia    ")
   Escreval ("==============================")
   Escreval ("Quantos alunos a turma tem?")
   Leia (quantidade)
   cont <- 1
   Escreval ("==============================")
   Enquanto (Cont < quantidade) faca
      Escreval ("Aluno ",cont)
      Escreval ("Nome do aluno: ")
      Leia (nome)
      Escreval ("Nota de ",nome)
      Leia (nota)
      Escreval ("==============================")
      Cont <- cont + 1
      Se (nota > maior) entao
         maior <- nota
         nome <- melhor_aluno
      FimSe
   FimEnquanto
   Escreval ("O melhor aluno da sala foi ",Melhor_aluno," com a nota de ",maior," pontos")
fimalgoritmo
Author: Maniero, 2016-11-20

1 answers

The assignment was reversed:

algoritmo "melhor aluno"
var
Quantidade,cont,nota,maior : real
nome,melhor_aluno : caractere
inicio
   Escreval ("==============================")
   Escreval ("    Escola Santa Paciencia    ")
   Escreval ("==============================")
   Escreval ("Quantos alunos a turma tem?")
   Leia (quantidade)
   cont <- 1
   Escreval ("==============================")
   Enquanto (Cont < quantidade) faca
      Escreval ("Aluno ",cont)
      Escreval ("Nome do aluno: ")
      Leia (nome)
      Escreval ("Nota de ",nome)
      Leia (nota)
      Escreval ("==============================")
      Cont <- cont + 1
      Se (nota > maior) entao
         maior <- nota
         melhor_aluno <- nome // <================ erro aqui
      FimSe
   FimEnquanto
   Escreval ("O melhor aluno da sala foi ", Melhor_aluno," com a nota de ", maior, " pontos")
fimalgoritmo

I put on GitHub for future reference.

 1
Author: Maniero, 2020-03-23 20:15:16