Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "pch.h"
- #include <string>
- using namespace std;
- enum NIVEL_DE_GRASA {
- ALTO = 3, MEDIO = 2, BAJO = 1
- };
- struct Paty {
- float precio;
- NIVEL_DE_GRASA nivelDeGrasa;
- int grosor;
- };
- ////////////////////////
- ListaPaty* listaPatyCreate() {
- ListaPaty *lista = new ListaPaty;
- lista->primerElemento = NULL;
- return lista;
- }
- NodoPaty* nodoPatyCreate(Paty *unPaty) {
- NodoPaty *unNodo = new NodoPaty;
- unNodo->unPaty = unPaty;
- unNodo->siguiente = NULL;
- return unNodo;
- }
- /////////////////
- void listaPatyAgregarNodo(ListaPaty *lista, NodoPaty *nodoPaty) {
- if (listaPatyEstaVacia(lista)) {
- lista->primerElemento = nodoPaty;
- }
- else {
- NodoPaty *ultimoNodo = listaPatyUltimoElemento(lista);
- ultimoNodo->siguiente = nodoPaty;
- }
- }
- bool listaPatyEstaVacia(ListaPaty *lista) {
- return lista->primerElemento == NULL;
- }
- NodoPaty* listaPatyUltimoElemento(ListaPaty *lista) {
- NodoPaty *nodoAuxiliar = lista->primerElemento;
- while (nodoAuxiliar->siguiente != NULL) {
- nodoAuxiliar = nodoAuxiliar->siguiente;
- }
- return nodoAuxiliar;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement