From: Leandro Lucarella Date: Tue, 4 Oct 2005 05:37:51 +0000 (+0000) Subject: Agrega signo a la salida del operator<< para un ostream. X-Git-Tag: Entrega_1~37 X-Git-Url: https://git.llucax.com/z.facultad/75.29/dale.git/commitdiff_plain/98630e6e5f233df5d628e57ca4cb5a315cffc9b2 Agrega signo a la salida del operator<< para un ostream. --- diff --git a/src/number.h b/src/number.h index e7e9c7b..43ed0b9 100644 --- a/src/number.h +++ b/src/number.h @@ -297,8 +297,12 @@ template < typename N, typename E > std::ostream& operator<< (std::ostream& os, const number< N, E >& n) { // FIXME sacar una salida bonita en ASCII =) - for (typename number< N, E >::const_iterator i = n.chunk.begin(); - i != n.chunk.end(); ++i) + if (n.sign == positive) + os << "+ "; + else + os << "- "; + for (typename number< N, E >::const_reverse_iterator i = n.chunk.rbegin(); + i != n.chunk.rend(); ++i) os << std::setfill('0') << std::setw(sizeof(N) * 2) << std::hex << *i << " "; return os;