A few problems I spotted by glancing over the code :
1)
>> double dep, withdraw;
These variable definitions belong outside of the switch.
As a side note : it's good practice to always initialize your variables as soon as you define them, for example :
double dep = 0.0, withdraw = 0.0;
That avoids a lot of unexpected problems later on. Make sure to initialize them to acceptable values that don't cause problems themselves.
2) You also seem to be missing break; statements at the end of your switch cases. I suggest to read up on switches a bit :
http://cplusplus.com/doc/t
(scroll down to the paragraph on switches)
3)
>> c.balance;
A statement like that doesn't actually do anything ... So it might as well not have been there.
4) You are missing a few end }'s (for your switch and your do loop for example).
5)
>> string firstName;
You are using the STL string without including the proper header for it :
#include <string>
6)
>> static double balance;
Making the balance a static member of the CheckingAccount class would mean that all checking accounts have the same balance ... I'm sure that's not what you intended, right ?
Start by fixing these, and then try compiling/running your code again. If you still have problems, then post the exact error messages you get and/or explain the wrong behavior you're noticing.
Main Topics
Browse All Topics





by: Ravi_KallaPosted on 2009-08-23 at 21:03:31ID: 25165542
Mention what kind of errors you are getting while compiling. It's not the practice in EE to give a direct/complete solution to the problem posted... But, to guide a person towords the solution. This will be benificial to you while programming in the future.