...

View Full Version : C++ lists



007julien
01-23-2013, 02:34 PM
Hello,
I try to work with C++...
How to retrieve the m_Digits list of int, with this hh (and particularly the GetDigits function) for a class of big Integers ?


class Integer
{
short m_Sign; // m_Sign<0 <=> this<0
list<int> m_Digits;

public:
Integer();
Integer(int n);
Integer(const char*);
Integer(const Integer& n);

short GetSign() const {return m_Sign;};
const list<int>& GetDigits() const {return m_Digits;};
The function to use to retrieve the digits
const list<int>& GetDigits() const {return m_Digits;};
//...
};
Integer abs(const Integer& a);
Integer fact(Integer a);
Integer pgcd(Integer a, Integer b);
Integer ppcm(Integer a, Integer b);
Integer pow(Integer a, int b);
Integer pow(Integer a, Integer b);
// The new function to build
Integer sqrt(Integer a);

I do not clearly understand the definition of the line

const list<int>& GetDigits() const {return m_Digits;};
and I am unable to declare a list<int> variable to retrieve this list.

Thanks !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum