Пример #1
0
//funcion para REMOVE()
void eliminarElemento(ArrayList* self)
{
	int i;
	char resp;
	
	do
	{
		
		resp = 'n';
		
		i = pedirNumero("Ingrese la posicion en la lista que desea borrar: ");
	
		i--;
	
		if(longitudLista(self, i) == 0)
			resp = preguntarSiSeguir("\nLa posicion no existe\nDesea volver a intentarlo?s/n: ");
		else
		{
			self -> remov(self, i);
			printf("\nPosicion borrada");
			
		}
			
			
		resp = tolower(resp);

	}while(resp != 'n');
	
	
	
	system("PAUSE");
	
}
Пример #2
0
//funcion para pop()
void muestraElimina(ArrayList* self)
{
	int i;
	char resp;
	
	do
	{
		resp = 'n';
		
		i = pedirNumero("Ingrese la posicion de la lista que desea obtener: ");
	
		i--;
	
		if(!longitudLista(self, i))
			resp = preguntarSiSeguir("\nLa posicion no existe\nDesea volver a intentarlo?s/n: ");
		else
		{
				
			printf("\nEl conenido de la posicion [%d] es: %d\n", i+1 , *(int*)(self->pop(self, i)));
			printf("\nHa sido eliminada\n");

		}		
		resp = tolower(resp);

	}while(resp != 'n');
	
		
	
	
	
	system("PAUSE");	
}
Пример #3
0
//funcion subList()
void subConjunto(ArrayList* self)
{
	int to, from;
	char resp;
	
	ArrayList* subLista;
	
	do
	{
		resp = 'n';
		
		from = pedirNumero("Ingrese la posicion desde donde desea empezar a copiar: ");
		
		to = pedirNumero("Ingrese la posicion hasta donde desea terminar de copiar: ");
	
		from--;
		to--;
		
		if(from > to)
			resp = preguntarSiSeguir("\nLas posiciones ingresadas son incorrectas\nDesea volver a intentarlo?s/n: ");
	
		else if(!longitudLista(self, from)||!longitudLista(self, to))
			resp = preguntarSiSeguir("\nLas posiciones ingresadas son incorrectas\nDesea volver a intentarlo?s/n: ");
		else
		{
			
			subLista = subList(self, from, to);
				
			printf("\nCONTENIDO DE LA SUBLISTA\n");
			
			mostrar(subLista);
			

		}		
		resp = tolower(resp);

	}while(resp != 'n');

	free(subLista);
	
}
Пример #4
0
wxSize nkMenuTool::obtenerTamanio(void){
	wxSize un_tamanio;
	if (estaDeplegado()){
		un_tamanio = wxSize(ANCHO_TOOLBAR
		,prv_toolbar->GetToolSize().GetHeight()*(longitudLista()+1)+4);
	}else{
		un_tamanio = wxSize(ANCHO_TOOLBAR
		,prv_toolbar->GetToolSize().GetHeight()+4);

	}
	return un_tamanio;
}
Пример #5
0
//funcion para push()
//inserta elemento en la lista
void insertaElemento(ArrayList* self)
{
	
	int i;
	char resp;
	int* numero;
	
	
	
	do
	{
		resp = 'n';
		
		i = pedirNumero("Ingrese la posicion de la lista que desea insertar: ");
	
		i--;
	
		if(!longitudLista(self, i))
			resp = preguntarSiSeguir("\nLa posicion no existe\nDesea volver a intentarlo?s/n: ");
		else
		{
			numero = (int*) malloc(sizeof(int));
	
			*numero = pedirNumero("Ingrese un numero a la posicion: ");
			
	
			self->push(self, i, numero);
			
			printf("\nElemento agregado con exito\n");

		}		
		resp = tolower(resp);

	}while(resp != 'n');
	
		
	
	
	
	system("PAUSE");
	
}