int main() { Lista lista = NULL; pNodo p; Insertar(&lista, 20); printf("%p,%d", lista->siguiente, lista->valor); getchar(); Insertar(&lista, 10); Insertar(&lista, 40); Insertar(&lista, 30); MostrarLista(lista); getchar(); Borrar(&lista, 10); Borrar(&lista, 15); Borrar(&lista, 45); Borrar(&lista, 30); Borrar(&lista, 40); MostrarLista(lista); BorrarLista(&lista); return 0; }
Matriz& Matriz::operator=(const Matriz& M){ if (this!=&M){ Borrar(); Copiar(M); } return *this; }
Arreglo<T>& Arreglo<T>::Mover(Nat posThis, Arreglo<T>& otro, Nat posOtro) { if(this != &otro or posThis != posOtro) { Borrar(posThis); array[posThis] = otro.array[posOtro]; otro.array[posOtro] = NULL; } return *this; }
int main() { EMovie E_peli; FILE *pFile; int opcion=0; if((pFile = fopen("Pelicula.bin", "rb+"))== NULL) if((pFile = fopen("pelicula.bin", "wb+"))==NULL) { printf("ERROR. No se puede abrir el archivo binario...\n"); exit(1); } while (opcion !=5) { Menu(); scanf("%d", &opcion); switch (opcion) { case 1: system("cls"); Agregar(&E_peli, pFile); break; case 2: system("cls"); Borrar(&E_peli, pFile); break; case 3: system("cls"); Modificar(&E_peli, pFile); break; case 4: system("cls"); Generar_PWeb(&E_peli, pFile); break; case 5: system("cls"); printf("Salir del programa....\n"); break; default : system("cls"); Val_Menu(&opcion,"Error opcion invalida. Vuelva al menu\n",""); break; } } fclose(pFile); return 0; }
int main ( int argc, char *argv[] ){ srand((int) time(NULL)); printf("Cuantas personas van a ser: "); scanf("%d",&numPersonas); struct Persona* personas = (struct Persona*) malloc (numPersonas * sizeof(struct Persona)); char*** preguntas = (char***) malloc (10 * sizeof(char**)); agregarPersona(personas); agregarPregunta(preguntas); llenarEncuesta(personas, preguntas); histograma(personas, preguntas); histogramaEdades(personas, preguntas); Borrar(personas, preguntas); return 0; }
Arreglo<T>& Arreglo<T>::Definir(Nat pos, const T& valor) { assert(pos < size); Borrar(pos); array[pos] = new T(valor); return *this; }
void Arreglo<T>::Destruir() { for(Nat p = 0; p < size; ++p) Borrar(p); delete[] array; array = NULL; }
Matriz::~Matriz(){ Borrar(); }