Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. void compraSegura(lista cab, string autor)
  2. {
  3. lista aux;
  4. nodoLibro *auxl,*temp,*mayorNota, *temp2;
  5.  
  6. if(cab==NULL)
  7. cout << "Lista vacia" << endl;
  8. else
  9. {
  10. aux=cab;
  11. while(aux!=NULL)
  12. {
  13. auxl=aux->libro;
  14. while(auxl!=NULL)
  15. {
  16. if(auxl->autor==autor)
  17. {
  18. if(temp==NULL)
  19. temp=auxl;
  20. else
  21. {
  22. temp2=temp;
  23. temp=auxl;
  24.  
  25. if(temp->nota>temp2->nota)
  26. mayorNota=temp;
  27. }
  28. }
  29. auxl=auxl->siguiente;
  30. }
  31. aux=aux->siguiente;
  32. }
  33.  
  34. cout << "Libro con mejor critica: " << mayorNota->titulo << endl;
  35. cout << "Nota de critica: " << mayorNota->nota << endl;
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement