I can't figure out how to run this Check Balancing Program. It has no compile time errors, but every time I wanna see the end balance..it outputs the same balance I put in to start. Are my function bodys right? Can anyone help?
Code:#include <iomanip.h> #include <stdlib.h> float Dep(float Bal, float Amount) { Bal=Bal+Amount; return 0;} float Check(float Bal, float Amount) { Bal=Bal-Amount; return 0;} float Charge(float Bal, float Amount) { Bal=Bal-Amount; return 0;} float Withdraw(float Bal, float Amount) { Bal=Bal-Amount; return 0;} main() { float Bal, Amount; char Comm; cout<<"\n BALANCING CHECKBOOK PROGRAM "; cout<<"\n --------------------------- "; cout<<"\n\n My Account "; cout<<"\n Enter Starting Balance : "; cin>>Bal; cout<<"\n Command Options: " <<"\n d- deposit" <<"\n c- check " <<"\n s- service charge " <<"\n w- withdrawal " <<"\n x- exit "<<endl; cout<<"\n Enter command: "; cin>>Comm; cout<<"\n Enter amount in dollars and cents: "; cin>>Amount; while(Comm != 'x') { cout<<"\n Enter another command: "; cin>>Comm; if(Comm == 'd') {Dep(Bal, Amount);cout<<"\n Enter amount in dollars and cents: "; cin>>Amount;} else if(Comm == 'c') {Check(Bal,Amount);cout<<"\n Enter amount in dollars and cents: "; cin>>Amount;} else if(Comm == 's') {Charge(Bal,Amount);cout<<"\n Enter amount in dollars and cents: "; cin>>Amount;} else if(Comm == 'w') {Withdraw(Bal,Amount);cout<<"\n Enter amount in dollars and cents: "; cin>>Amount;} else if(Comm == 'x') {cout<<"\n Your New Balance is: $"<<Bal; break;} } system("PAUSE"); return 0; }



LinkBack URL
About LinkBacks


