declare a hugo integer by array or string.
Please help me!

(HugeInteger Class) Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40 digits each. Provide member functions input, output, add and substract. For comparing HugeInteger objects, provide functions isEqualTo, isNotEqualTo, isGreaterThan, isLessThan, isGreaterThanOrEqualTo and isLessThanOrEqualToeach of these is a "predicate" function that simply returns TRue if the relationship holds between the two HugeIntegers and returns false if the relationship does not hold. Also, provide a predicate function isZero. If you feel ambitious, provide member functions multiply, divide and modulus.

<Exercise How to programming C++>

Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40 digits each.

when i declare, has notice : "do'nt enought memory"

> when i declare, has notice : "do'nt enought memory"
So post your attempt then, so it doesn't look like you're just dumping your assignment on us and expecting a polished answer on a plate (it won't happen).

my code.

exam : When i add:

111 + 333 =444
but
444 + 666 -> do'nt has resault.

when strlen(num1) < strlen(num2) -> program do'nt execute

Your code doesn't even compile properly.
What is this: if(nho>0) fix it

So where is your class?

> Create a class HugeInteger that uses a 40-element array of digits to store
> integers as large as 40 digits each.

class HugeInteger {
  private:
    char myInt[40];
  public:
};

> Provide member functions input, output, add and substract etc etc
Now try ONE of those functions with the above and post your code.

Your code doesn't even compile properly.
What is this: if(nho>0) fix it

Ok, -> if(memory>0)

So where is your class?

> Create a class HugeInteger that uses a 40-element array of digits to store
> integers as large as 40 digits each.

class HugeInteger {
  private:
    char myInt[40];
  public:
};

> Provide member functions input, output, add and substract etc etc
Now try ONE of those functions with the above and post your code.

class HugeInteger {
private:
char myInt[40];
public:
void input();
void output();
void add(char *s1,char *s2,char *s3);
void sub(char *s1,char *s2,char *s3);
void insert(char *s1,char *s2);
};

Ok, i define functions in my code (file attach above)

Why does insert need 2 params?
Why does your implementation trash memory rather than copying to the instance variable.
None of your functions are members of a class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.