Originally posted by Guti14
Code:#include<iostream> #include<conio> #include<iomanip> using namespace std; int main(int argc, char* argv[]) { int accountNumber; double beginningBalance; double totalCharges; double totalCredits; double creditLimit; double balance; What is the value of beginningBalance, totalCharges, and totalCredits at this point of the program? Is this the best place for the calculation? balance = beginningBalance + totalCharges - totalCredits; cout << setprecision( 6 ) << fixed; while( accountNumber != -1 ) { cout << "Enter account Number: " << endl; cin >> accountNumber; cout << "Enter beginning balance: " << endl; cin >> beginningBalance; cout << "Enter total charges: " << endl; cin >> totalCharges; cout << "Enter total credit: " << endl; cin >> totalCredits; cout << "Enter credit limit: " << endl; cin >> creditLimit; What is the value of balance at this point in the code? You just did a bunch of inputs -- what do you plan on doing with the information? if ( balance >= creditLimit ) { cout << "Account: " << accountNumber << endl; cout << "Credit limit: " << creditLimit << endl; cout << "Balance: " << balance << endl; cout << "Credit Limit Exceeded" << endl; } else cout << "Enter beginning balance: " << endl; cin >> beginningBalance; cout << "Enter total charges: " << endl; cin >> totalCharges; cout << "Enter total credit: " << endl; cin >> totalCredits; cout << "Enter credit limit: " << endl; cin >> creditLimit; } getch(); return 0; }