Che è 'sta linea ?
while(in.get() != "%end")
Ovvio che ti dia errore.