Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <math.h>
- using namespace std;
- int main() {
- int acc = 0;
- cout << "BALANCE VERIFICATION TOOL" << endl;
- while (acc != -1 ) {
- float bal, newbal, charges, credits, creditlim;
- cout << "=============================================\n";
- cout << "Enter account number (-1 to end): ";
- cin >> acc;
- if (acc == -1) {
- break;
- }
- else {
- cout << "Enter beginning balance: ";
- cin >> bal;
- cout << "Enter total charges: ";
- cin >> charges;
- cout << "Enter total credits: ";
- cin >> credits;
- cout << "Enter credit limit: ";
- cin >> creditlim;
- cout << "---------------------------------------------\n";
- newbal = bal + charges - credits;
- if (newbal > creditlim){
- cout << "New balance: " << newbal << "\n";
- cout << "Account: " << acc << "\n";
- cout << setiosflags(ios::fixed) << setprecision(2) << "Credit limit: " << creditlim << "\n";
- cout << "Credit Limit Exceeded.\n";
- cout << "=============================================\n";
- cout << endl << endl;
- }
- else {
- cout << setiosflags(ios::fixed) << setprecision(2) << "New balance: " << newbal << "\n";
- cout << "=============================================\n";
- cout << endl << endl;
- }
- }
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement