Need Help for my operator << code !!!

I have a problem that about operator<< in LargeInt. When I Run this program. operator always print 1 end of any number. for example, I input 12. it will output 121. i checked all of other function.they are working well.
only operator << How can i fix this problem

Here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
template<class x>
x DoublyLink<x>::printInfo(DoublyLink<x>& other)
{
	bool result=true;
	if (other.isEmpty())
	{
		result = false;
		cout << "The list is empty";
	}
	else
	if(result)
	{
		node<x> *p;
		for (p = other.last;p != other.first->prev;p = p->prev)
			cout<<p->info;
	}
	return result;
}


1
2
3
4
5
6
std::ostream & operator<<(std::ostream& out, LargeInt& other)
{
	out << other.printInfo(other);

	return out;
}



I implement the printinfo to operator << in LargeInt.cpp
Last edited on
Topic archived. No new replies allowed.