Note - I'm still learning c++... so there could be better ways of coding this. Try not to introduce new concepts - this will only aid in confusing me more, but please be more than welcomed to tell that i'm using something incorrectly.
// Classes - Using class to design a mock bank account
//
#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
#include "Saving.h"
int main (int nNumberofArgs, char* pszArgs[])
{
cout << "Enter 1 to create an account : ";
int nEntered;
cin >> nEntered;
for(;;)
{
if( nEntered == 1)
{
BankAccount s;
cout << " Bank account created\n If you would like to make a deposit press 1";
break;
}
else
{
cout << "You didn't enter a vaild number";
}
}
int nAnother;
for(;;)
{
if(nAnother || nEntered == 2)
{ cout << "How much do want to deposit : ";
int ndeposit;
cin >> ndeposit;
s. deposit(ndeposit)
break;
}
else
{
cout << "You didn't enter a vaild number";
}
system("PAUSE");
return 0;
}
}
Header file:
class BankAccount
{
public:
unsigned accountNumber;
double balance;
double deposit(int money)
{ balance += money;
cout << "Your current balance is : " << balance << endl;
return balance; }
}