Operator<< for ostream

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Oliver Block

    Operator<< for ostream

    Hi @ll,

    I'am programming a class for big integer number. I needed one for
    powers because int an long didn't fulfill my needs.

    I coded some operators but now I am somehow lost. I store the digits
    for my class in a valarray and I'd like to output them on cout for
    example.

    Is there a better way than to copy the digits to a String and return
    the string?

    I appreciate your hints!

    bye,

    Oliver

  • Viktor Prehnal

    #2
    Re: Operator&lt;&lt ; for ostream

    operator<< writes directly to output stream

    class A {


    friend ostream& operator<<(ostr eam& os, const A& a) {
    os << ............... .
    return os;
    }
    };

    Oliver Block wrote:[color=blue]
    > Hi @ll,
    >
    > I'am programming a class for big integer number. I needed one for
    > powers because int an long didn't fulfill my needs.
    >
    > I coded some operators but now I am somehow lost. I store the digits
    > for my class in a valarray and I'd like to output them on cout for
    > example.
    >
    > Is there a better way than to copy the digits to a String and return
    > the string?
    >
    > I appreciate your hints!
    >
    > bye,
    >
    > Oliver
    >[/color]

    Comment

    • Oliver Block

      #3
      Re: Operator&lt;&lt ; for ostream

      Hi,

      my question refered to the dots. :-)

      Never mind!

      Comment

      Working...