with a lil bit of change in code ,it's functioning, but I want it to function with data members being private :-/
#include<iostream.h>
#include<conio.h>
class account{
public:
int account_number;
float balance;
int passw;
public:
void display()
{
cout<<"Account number is:"<<account_number<<endl<<
"Account balance is:"<<balance<<endl;
}
void user(int acc, float amou, int passy)
{
account_number=acc;
balance=amou;
passw=passy;
}
void validate(int acce, int passu)
{
account_number=acce;
passw=passu;
}
};
void main()
{
int acno;
float amount;
int const n=1;
account uxi[n];
int pass;
for(int i=0;i<n;i++)
{
cout<<"Enter account number";
cin>>acno;
cout<<"set the password for your account";
cin>>pass;
cout<<"Enter the amount you want to deposit";
cin>>amount;
uxi[i].user(acno,amount,pass);
}
for(i=0;i<n;i++)
{
cout<<"Enter the account number";
cin>>acno;
if(acno==uxi[i].account_number)
{
cout<<"Enter the password for the account";
cin>>pass;
}
if(pass!=uxi[i].passw);
{
cout<<"the password you entered is incorrect";
if(pass==uxi[i].passw)
uxi[i].display();
}
};
}