//
//
//
//
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
class account
{
    public:
        double balance = 0;
        string name;
        static numberofaccounts;
        account (string accountname)
        {
            cout << "Constructing account...";
            cout << "Account constructed.";
            name = accountname;
            numberofaccounts = ++numberofaccounts;
        }
        ~account ()
        {
            cout << "Destructing accounts...";
        }
            
        void currentbalance ()
        {
            cout << "Your current balance is " << balance << ".";
        }    
        
        void deposit ()
        {
            int depositcorrect = 1;
            int depositquit = 1; 
            double depositamount = 0;
            cout << "You have selected the deposit function.";
                
            for (;;)
            {
                cout << "Please enter in the amount you wish to deposit: ";
                cin >> despositamount;
                cout << "You entered " << despositamount;
                cout << "If this is correct, enter 1, if not enter 2.\n";
                cout << "Enter in any number other than 1 or 2 to exit the deposit function.\n";
                cin >> depositcorrect;
                
                if (depositcorrect < 1 || depositcorrect > 2)
                {
                    cout << "Now exiting the deposit funcion...";
                    break;
                } 
                
                if (depositcorrect == 1)
                {     
                    balance += depositamount;
                    cout << "You have just deposited" << depositamount << " dollars into your account.";
                    cout << "You're current balance now is " << balance << ".";
                    cout << "Enter 1 to make another deposit, otherwise, enter any other number to quit this function";
                    cin >> depositquit;
                    if (depositquit != 1)
                    {
                        break;
                    }
                }
                
                if (depositcorrect == 2)
                {
                    cout << "You have chosen 2, in that the deposit amount enter is incorrect.";
                }
            }
        }
        
        double withdraw ()
        {
            double withdrawlamount = 0;
            int withdrawlcorrect = 1;
            int withdrawlquit = 1;
            cout << "You have selected the withdrawl function.";
                
            for (;;)
            {
                cout << "Please enter in the amount you with to withdraw: ";
                cin >> withdrawlamount;
                cout << "You entered " << withdrawlamount;
                cout << "If this is correct, enter 1, if not, enter 2.\n";
                cout << "Enter in any number other than 1 or 2 to exit the withdrawl function.\n";
                cin >> withdrawlcorrect;
                
                if (withdrawlcorrect < 1 || withdrawlcorrect > 2)
                {
                    cout << "Now exiting the withdrawl function...";
                    break;
                }
                
                if (withdrawlcorrect == 2)
                {
                    cout << "You have chosen 2, in that the deposit amount enter is incorrect.";
                }
                
                if (withdrawlcorrect == 1)
                {
                    balance -= withdrawlamount;
                    cout << "You have just withdrawn " << withdrawlamount << " dollars from your account.";
                    cout << "Your current balance now is " << balance << ".";
                    cout << "Enter 1 to make another withdrawl, otherwise, enter any other number to quit this function";
                    return withdrawlamount;
                }
            }
        }
};
                
                
int main (int nNumberofArgs, char* pszArgs[])
{
    double deposit;
    double withdrawl;
    double cash;
    
    string accountname;
    
    cout << "Enter in the name of the account you would like to create: ";
    cin >> accountname;
    account account1(accountname);
    
    cout << "Enter 'd' to deposit money into your account.";
    cout << "Enter 'w' to withdraw money from your account.";
    cout << "Enter 'b' to view your accont's balance.";
    
    switch (choice)
    {
        case 'd':
        account1.deposit;
        
        case 'w':
        cash = account1.withdraw;
        
        case 'b':
        account1.currentbalance;
    }
    
    system ("Pause");
    return 0;
}