Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstdlib>
- #include <iostream>
- #include <string>
- using namespace std;
- void doit(void);
- void handleCommand(string cmd);
- // The current user's credentials.
- string USER;
- string PASS;
- // An Account class that holds their balance, first and last names,
- // and their PIN number.
- class Account
- {
- public:
- // Deposits money into this account.
- void deposit(double amt)
- {
- balance += amt;
- }
- // Account holder's first and last name.
- string firstName;
- string lastName;
- // Account number. Example: 1034
- unsigned accountNumber;
- // Account balance. Example: 134.50 $
- double balance;
- };
- // The Bank class which stores accounts.
- class Bank
- {
- public:
- // Counts the amount of accounts in use at this Bank.
- int countAccounts()
- {
- int count = 0;
- // Loop through each account.
- for each(Account acc in accounts)
- {
- // Check if there is no name assigned.
- if(acc.firstName._Mysize != 0)
- {
- count++;
- }
- }
- return count;
- }
- // This Bank's accounts. Maximum ammount of 10.
- Account accounts[10];
- };
- // Access-point to the application.
- int main(int numArgs, char* args[])
- {
- // Fire welcome message.
- cout << "Welcome to Bank Server T-One." << endl;
- cout << "Please enter your username and password to begin." << endl << endl;
- // Ask for and receive username.
- cout << "Enter your username: ";
- getline(cin, USER);
- // Ask for and receive password.
- cout << "Enter your password: ";
- getline(cin, PASS);
- // Do an account credential check.
- if(USER == "admin" && PASS == "mypass")
- {
- cout << "Welcome " << USER << "!" << endl;
- } else
- {
- cout << "Login failed! Invalid username or password." << endl;
- system("pause");
- return 0;
- }
- doit();
- system("pause");
- return 0;
- }
- // A simple blocking call.
- void doit(void)
- {
- // Listen for commands until the user enters the 'quit' command.
- while(true)
- {
- string cmd;
- cout << "> ";
- getline(cin, cmd);
- if(cmd == "quit")
- {
- cout << "Goodbye." << endl;
- break;
- }
- }
- }
- void handleCommand(string cmd)
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement