#include #include #include "complex.h" #include "stack-c.h" /* Class Stack */ Stack* Stack::create(int n) { Stack* pS = new Stack(); pS->top_ = -1; pS->size_ = n; pS->elems_ = new TPELEM[n]; return pS; } /* Class StackIterador */ void StackIterador::init( class Stack* pS ) { pPilha_ = pS; indElemPilha_ = -1; } TPELEM StackIterador::prox( void ) { return( pPilha_->elems_[++indElemPilha_] ); } int StackIterador::fim( void ) { return( (indElemPilha_ == pPilha_->top_) ? 1 : 0 ); } void StackIterador::percorrePilha( void ) { for( int i=pPilha_->top_; i>=0; i-- ) { Complex c=pPilha_->elems_[i]; printf("%d:%7.4f,%7.4f\n", i, c.real(), c.imag()); cout<