Advertisement
athacks

Untitled

Mar 26th, 2014
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int acc = 0;
  9.     cout << "BALANCE VERIFICATION TOOL" << endl;
  10.     while (acc != -1 ) {
  11.         float bal, newbal, charges, credits, creditlim;
  12.         cout << "=============================================\n";
  13.         cout << "Enter account number (-1 to end): ";
  14.         cin >> acc;
  15.         if (acc == -1) {
  16.             break;
  17.         }
  18.         else {
  19.             cout << "Enter beginning balance: ";
  20.             cin >> bal;
  21.             cout << "Enter total charges: ";
  22.             cin >> charges;
  23.             cout << "Enter total credits: ";
  24.             cin >> credits;
  25.             cout << "Enter credit limit: ";
  26.             cin >> creditlim;
  27.             cout << "---------------------------------------------\n";
  28.             newbal = bal + charges - credits;
  29.             if (newbal > creditlim){
  30.                 cout << "New balance: " << newbal << "\n";
  31.                 cout << "Account: " << acc << "\n";
  32.                 cout << setiosflags(ios::fixed)  << setprecision(2)  << "Credit limit: " << creditlim << "\n";
  33.                 cout << "Credit Limit Exceeded.\n";
  34.                 cout << "=============================================\n";
  35.                 cout << endl << endl;
  36.             }
  37.             else {
  38.                 cout << setiosflags(ios::fixed) << setprecision(2) << "New balance: " << newbal << "\n";
  39.                 cout << "=============================================\n";
  40.                 cout << endl << endl;
  41.             }
  42.         }
  43.     }
  44.  
  45.     return(0);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement