Could someone tell me what is wrong with the boolean operators in this program
thanks!!
Code:#include <iostream> #include "test2.h" using namespace std; int main() { double balance, chargeAmt,c,payAmt, bal,C ,P,D, Q; string trans; cout<<"Enter beginning balance. "; cout<<endl; cin>>balance; cout<<endl; if (cin.fail()) { cout<<"ERROR! Bad Input!!"; return 1; } cout<<"How can we be of service today?"; cout<<endl; do { cout<<"Enter transaction: (C, P, D, Q) "; cin>>trans; cout<<endl; } while (trans != Q); if(trans == C) { cout<<"Amount of charge: "; cin>>chargeAmt; cout<<endl; bal = charge_amount(balance,chargeAmt); cout<<"Your new balance is "<<bal; } else if (trans == P) { cout<<"Payment amount: "; cin>>payAmt; cout<<endl; bal = pay_amount(balance,payAmt); cout<<"Your new balance is "<<bal; } else if (trans == D) { cout<<"Your balance is "<<bal; cout<<endl; } else if (trans == Q) { cout<<"Good Bye!"; cout<<endl; } else cout<<"Enter valid input!"; return 0; }



LinkBack URL
About LinkBacks


