Operator<< for ostream

O

Oliver Block

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
 
V

Viktor Prehnal

operator<< writes directly to output stream

class A {


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top