Solved

# Integer calculator in C++

Posted on 1998-07-05

I have to write a program which will perform integer arithmetic operations on integers up to 200 digits in significance. You need to implement only the +, *, *=,=,<=,+=,<<, and >> operators. Use the following main():

void main()

{

BigNum limit(100);

BigNum(0);

BigNum fact(1);

BigNum inc_value(1);

int j=1;

for(BigNum i=1; i <= limit; i += inc_value)

{

sum = sum + i;

fact *= i;

}

cout << "Sum from 1 to "

<< limit << "=" << sum << endl;

cout << "Factorial of " << limit

<< "=" << fact << endl;

BigNum first(0), second(0);

cout <<"Enter First Number --->";

cin>> first;

cout << "Enter Second Number--->";

cin >> second;

cout << endl << "The answer is "

<< first << "+" << second

<< "=" << first + second << endl;

cout <<"The product is " << first * second <<endl;

}

You have only 'til July 7th to get the answer.

Thanks.