this is my codes in banking system
please bear with my codes..im just new in doing classes
*can you help me with this error..tnx!!
#include<stdio.h>
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#include <time.h>
class Account
{
public:
void Account::existing(void)
{
cout<<"Account #: ";
cin>>user;
cout<<"Pin # : ";
cin>>pin;
for(i=0;i<3;i++)
{
if(!strcmp("dlsl",user)&&("3645",pin))
{
cout<<"The account # and pin # you entered is not valid\nTry Again"<<endl;
if(i=2)
{
cout<<"Not Registered Account!"<<endl;
}
else
{
}
}
}
void Account::opennew(void)
{
cout<<"Enter your Opening Deposit Amount: ";
cin>>bal;
if(bal<500)
{
cout<<"Insufficient Funds\nAccount cannot be created!\nPlease deposit more than P500.00.\n";
}
cout<<"Enter your name : ";
cin>>name[a];
cout<<"Enter your Address: ";
cin>>addr[a];
john.display();
cout<<"Your account is created!\nAccount No. "<<accno<<"\nCurrent Balance is "<<bal<<endl;
cout<<"Do another Transaction? Y/N?";
cin>>c;
if(c=='Y')
{
john.meenu();
}
private:
char user, pin, c;
char name[20], addr[30];
int bal, a;
};
class Menu
{
public:
void Menu::meenu(void)
{
cout<<"\t\tWELCOME!\n\n";
cout<<"[1] Deposit"<<endl;
cout<<"[2] Withdraw"<<endl;
cout<<"[3] Interest"<<endl;
cout<<"[4] Quit"<<endl;
cout<<"Enter your choice: ";
cin>>ch;
switch(ch);
{
case 1:
{
john.deposit();
break;
}
case 2:
{
john.withdraw();
break;
}
case 3:
{
john.interest();
break;
}
case 4:
{
exit(0);
}
}
system("cls");
}
void Menu::display(void)
{
cout<<"Hello! "<<name[a]<<endl;
cout<<"Your Address is "<<addr[a]<<endl;
}
void Menu::deposit(void)
{
float amt;
cout<<"\nEnter amount to be deposited: ";
cin>>amt;
bal=bal+amt;
cout<<"Your current Balance is "<<bal<<endl;
}
void Menu::withdraw(void)
{
float amt;
cout<<"\nEnter amount to be withdrawn: ";
cin>>amt;
if(bal-amt<500)
{
cout<<"\nInsufficient funds\nAmount cannot be withdrawn!\nPlease keep a minimum balance P500.00\n";
}
bal=bal-amt;
cout<<"Your current balance is "<<bal<<endl;
}
void Menu::interest(void)
{
float interest;
float rate;
rate=0.025;
interest=bal*rate;
bal=bal+interest;
cout<<"Interest Amount: "<<interest<<endl;
cout<<"Total Amount : "<<bal<<endl;
}
private:
char ch, name[20],addr[30];
int a, bal, amt;
};
class Extras
{
public:
void Extras::receipt(void)
{
rrr=fopen("receipt.txt","wa");
fprintf(rrr,"BANKO MISMO\n\n");
fprintf(rrr,"Name: %s\n",name[a]);
fprintf(rrr,"Account Number: %d\n",accno);
fprintf(rrr,"\tTHIS WILL SERVE AS YOUR OFFICIAL RECEIPT\n");
fprintf(rrr,"\t\tTHANK YOU!!!!\n");
fclose(rrr);
}
void Extras:: date(void)
{
char date[9];
char time[9];
_strdate(date);
cout<<"The current date is "<<date<<endl;
_strtime(time);
cout<<"The current time is "<<time<<endl;
}
private:
FILE *rrr;
char name[a];
int accno;
float bal;
};
int main(void)
{
Account abby;
Menu john;
Extras ewn;
cout<<"[1] Open New Account "<<endl;
cout<<"[2] Existing Account "<<endl;
cin>>choice;
if(choice==1)
{
abby.existing();
}
else
{
abby.opennew();
}
system("cls");
}