Skip to content

Instantly share code, notes, and snippets.

@maxenglander
Created September 22, 2012 19:42
Show Gist options
  • Save maxenglander/3767558 to your computer and use it in GitHub Desktop.
Save maxenglander/3767558 to your computer and use it in GitHub Desktop.
Welcome is inside loop
//-----------------------------------------------------------------
// EGR 126 fall 2012
// Student Name: Rebecca Brenneis
// Assignment: A4
// Submission Date: 9/23/12
// ----------------------------------------------------------------
//
#include <iostream> // required for cin, cout, edl.
#include <cmath> // required for sqrt()
using namespace std;
int main()
{
//Declare objects
double checkingMoney = 0, savingsMoney = 0, xinput_main, xinput_deposit, xinput_balance, depositChecking, depositSavings;
xinput_main = 0;
//while loop for user action
while (xinput_main !=3)
{
// welcome message
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" <<endl;
cout << "Welcome to MyBank ATM" <<endl;
cout << "Your Friend in the Market" <<endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" <<endl;
//Main Menu
cout << "How can I help you today?" << endl;
cout << "1) Deposit Money" << endl;
cout << "2) Check the balance" << endl;
cout << "3) Nothing. Exit" << endl;
cin >> xinput_main;
if (xinput_main == 1) //deposite money
{ cout<<"=============================" <<endl;
cout << "Thank you for depositing funds today" <<endl;
cout << "Please make your selection" <<endl;
cout << "1) Deposite into Checking" << endl;
cout << "2) Deposite into Savings" <<endl;
cout << "3) Back to Main Menu" << endl;
cout << "-----------------------------" <<endl;
cin >> xinput_deposit;
if (xinput_deposit == 1) //deposit checking
{ cout << "Please enter dollar ammount" << endl;
cin >> depositChecking;
(checkingMoney = depositChecking + checkingMoney);
}
else if (xinput_deposit == 2) //deposit savings
{ cout << "Please enter dollar amount" << endl;
cin >> depositSavings;
(savingsMoney = depositSavings + savingsMoney);
}
}
else if (xinput_main == 2) //check the balance
{ cout << "======================================" <<endl;
cout << "Your Checking Balance = " << checkingMoney <<endl;
cout << "Your Savings Balance = " << savingsMoney <<endl;
cout << " " << endl;
cout << "Please make your selection" << endl;
cout << "1) deposit more money" << endl;
cout << "2) Nothing. Exit" << endl;
cin >> xinput_balance;
if (xinput_balance == 1) //return to desposit menu
{ (xinput_main = xinput_main - 1);
}
else if (xinput_balance == 2) //exit atm
{ break; 2;
}
else //invalid entry
{ cout << "Invalid entry" <<endl;
cout << "Please try again" <<endl;
xinput_main = 0; continue;
}
}
else //invalid entry
{ cout << "Invalid entry" << endl;
cout << "Please try again" << endl;
xinput_main = 0; continue;
}
}
cout <<"=====================================" <<endl;
cout <<"Thank you for your business Today" <<endl;
cout <<"Hope to see you sometime soon..Bye." <<endl;
cout <<"=====================================" <<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment