Could you please tell me what I am doing wrong? I am trying to overload the + operator, and output the sum of the 5 numbers (a, b, c, d, e).
Code:#include <iostream.h> #include <math.h> class BigInteger{ private: public: double a, b, c, d, e; void initial(); //sum(BigInteger &one, BigInteger &two); friend BigInteger operator+(BigInteger); }; void BigInteger::initial() { cout << "Please enter 5 integers: " ; cin >> a >> b >> c >> d >> e; } BigInteger operator+(BigInteger &num) { //BigInteger num; num = ; // what do I put here??? return num; } int main() { BigInteger one, two; one.initial(); cout << one.a << one.b << one.c << one.d << one.e <<endl; return 0; }



LinkBack URL
About LinkBacks



