/* a header file containing the definitions of the class BigInt, used with the program readints.cpp */ #include #include class BigInt{ private: /* This is the syntax to have a const data member of a class. */ static const int NUM_DIGITS = 20; int num[NUM_DIGITS]; public: void read_num(ifstream&); /* reads in an integer from the input file */ void print_num(); /* prints out the integer to the screen */ // BigInt sum(BigInt); /* You should implement this function below. */ }; void BigInt::read_num(ifstream& infile){ int a[NUM_DIGITS], i,j; char inp; /* skip everything before the first integer starts */ do infile.get(inp); // similar to infile >> inp, but doesn't // skip over white space. while (inp<'0' || inp>'9'); a[0] = inp - '0'; for(i=1; i=0; i--){ if (num[i]) initialzero = false; if (!initialzero || i==0) cout << static_cast(num[i]+'0'); } }