User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 401,967 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,931 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.

Overloaded + operator not working correctly.

Join Date: Feb 2008
Posts: 12
Reputation: Jaycii is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Jaycii Jaycii is offline Offline
Newbie Poster

Overloaded + operator not working correctly.

  #1  
Feb 17th, 2008
I am trying to use an overloaded + operator to find the total balance for two values. I am messing up with the way to set them up, or forgetting something. I am getting values such as -9.543e2433

The code I am using for the operator is

Account operator+(Account &right)
{
Account temp;
int temp2;
temp2 = (savings + right.getchecking());
temp.setTotalBalance(temp2);
return temp;
}

I've looked for examples to see if I did it wrong, but from what I have looked at, it should have worked, unless I am not noticing something.

Any tips or suggestions on how I could go about fixing it would help me greatly.
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 6:41 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC