elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / Ayuda con CODE BLOCKS 8.02 en: 27 Noviembre 2012, 18:29 pm
Hola,
  quiero ejecutar un código, en c++ mi problema es el siguiente me compila perfectamente, pero quiero hacer correr en modo debugg, y no me habilita esa opción, ya busque mucho sobre como habilitar, probé de todo, pero igual sigue des habilitado esa opción... si alguien me puede dar una mano con esto

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <iostream.h>

//Declaración:

struct tcola
{
int num;
struct tcola *sig;
};

// Prototipos
void crear(struct tcola **frente, struct tcola **final);
int vacia(struct tcola **frente);
void encolar(struct tcola **frente, struct tcola **final, int elem);
int desencolar(struct tcola **frente, struct tcola **final);

int main(void)
{
struct tcola *frente, *final;
int elem;
crear(&frente,&final);

cout<<"\n Ingrese elementos: (0 para terminar) \n\n";
do{
cout<<"Num: ";
cin>>elem;

encolar(&frente, &final, elem);
}while(elem !=0);

if (vacia(&frente)) cout<<"\nCola vacia!";
else
while(!vacia(&frente))
{
elem=desencolar(&frente,&final);
cout<<"\n Num: "<<elem;
}
system("pause");
return 0;

}

// Crear o inicializar:

void crear(struct tcola **frente,struct tcola **final)
{
*frente = NULL;
*final = NULL;
}

// Función que devuelve cierto si la cola está vacía:

int vacia(struct tcola **frente)
{
return (*frente == NULL);
}

// Encolado:

void encolar(struct tcola **frente, struct tcola **final, int elem)
{
struct tcola *nuevo;

nuevo = (struct tcola *) malloc(sizeof(struct tcola));
nuevo->num = elem;
nuevo->sig=NULL;

if (*final ==NULL)
*frente = nuevo;
else {
(*final)->sig = nuevo;

}
*final = nuevo;

}

// Desencolado:

int desencolar(struct tcola **frente, struct tcola **final)
{
struct tcola *aux;
int elem;

aux=*frente;
elem = aux->num;
*frente = aux->sig;
if (*frente ==NULL) *final = NULL;

free(aux);
return elem ;

}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines