Skip to content

Instantly share code, notes, and snippets.

@brand-it
Created June 7, 2012 15:32
Show Gist options
  • Save brand-it/2889470 to your computer and use it in GitHub Desktop.
Save brand-it/2889470 to your computer and use it in GitHub Desktop.
Bank program not no name input
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
float balance;
void balanceStatment(){
cout << "Your current balance is: $" << balance << endl;
}
void asker(){
float deposit;
float withdraw;
char answer;
balanceStatment();
cout << "Please enter a new amount you would like to deposit: ";
cin >> deposit;
balance = balance + deposit;
cout << "Your new balance is: " << balance << endl;
cout << "Would you like to make a withdraw(Y = yes, N = no)?" << endl;
cin >> answer;
if (toupper(answer) == 'Y'){
cout << "How much would you like to withdraw? ";
cin >> withdraw;
balance = balance - withdraw;
}
}
void calculateInterest(){
float interest = 0.08;
float interest_recived;
interest_recived = balance * interest;
cout << "The amount you will recive in interest is $" << << setiosflags(ios::fixed) << setprecision(2) << interest_recived << endl;
}
void main(){
asker();
calculateInterest();
balanceStatment();
system("pause");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment