CBDC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
#include
#include
#include
#include
#include
#include
#include
void password(void)
{
int counter=0;
char username[20];
char password[15];
char str[20];
fstream user;
fstream pass;
user.open("username.dat",ios::binary|ios::in|ios::out);
pass.open("password.dat",ios::binary|ios::in|ios::out);
do
{
clrscr();
cout<<"\n\n\n\n\n\t\t\t USERNAME ";
cout<<"\n\n\t\t ";
gets(username);
user.read((char*) &str,sizeof(str));
user.close();
if(strcmp(str,username)==0)
{
clrscr();
cout<<"\n\n\n\n\n\t\t\tPASSWORD ";
cout<<"\n\n\t\t ";
gets(password);
pass.read((char*) &str,sizeof(str));
pass.close();
if(strcmp(str,password)==0)
{ clrscr();
cout<<"\n\n\n\n\t\t\tACCESS ALLOWED....";
delay(1500);
return;
}
else
{
cout<<"\n\n\t\t\tACCESS DENIED!!!!";
delay(2500);
continue;
}
}
counter++;
}while(counter<3);
clrscr();
cout<<"\n\n\n\n\n\n\t\t\t";
char arr[35]={"CLOSING DUE TO SECURITY THREAT"};
for(int i=0;i<35;i++)
{ cout<>acctno;
fin.close();
}
void addnewrecord();
void viewrecord();
void updaterecord();
void read();
int get_acctno();
void display();
};
/*
This method is for adding a new account record. The details are added in the dat file accountdets.dat.
*/
void account::addnewrecord()
{
ofstream outfile;
outfile.open("accountdets.dat",ios::out|ios::binary|ios::app);
account person;
cout<>person.deposit;
ofstream fout;
fout.open("acctno.dat",ios::out);
fout<>accno;
}
/*
This method returns the account number that is input by the user.
*/
int account::get_acctno()
{
return accno;
}
/*
This method is used for viewing the account details from the dat file, given a specific account number as input.
*/
void account::viewrecord()
{
ifstream f2;
account t2,t02;
t02.read();
f2.open("accountdets.dat",ios::binary|ios::in);
f2.seekg(0,ios::beg);
int j=0;
while(!f2.eof())
{
f2.read((char*) &t2,sizeof(t2));
if(t2.acctno==t02.get_acctno())
{
j=1;
t2.display();
break;
}
}
if(j!=1)
cout<<"\nRecord not found...";
f2.close();
cout<<"\n\n\t\t\t(Press any key to return to MAIN MENU..)";
getch();
}
/*
This method is used by the viewrecord method to output the specific account record details.
*/
void account::display()
{
cout<<"\n";
cout<<"First name : "<>ch2;
clrscr();
switch(ch2)
{
case 1:
{
fstream f3;
account t3,t03;
int j=0, count=0;
t03.read();
cout<<"\nPlease enter the amount to be debited : ";
cin>>debit;
f3.open("accountdets.dat",ios::binary|ios::in|ios::out);
f3.seekg(0,ios::beg);
while(!f3.eof())
{
f3.read((char*) &t3,sizeof(t3));
if(t3.acctno==t03.get_acctno())
{
j++;
break;
}
count++;
}
if(j!=0)
{
if(debit<=t3.deposit)
{
t3.deposit-=debit;
f3.seekp(count*sizeof(t3),ios::beg);
f3.write((char*) &t3 ,sizeof(t3));
}
if(t3.deposit>=250)
cout<<"Your account balance is Rs"<>credit;
f4.open("accountdets.dat",ios::binary|ios::in|ios::out);
f4.seekg(0,ios::beg);
while(!f4.eof())
{
f4.read((char*) &t4,sizeof(t4));
if(t4.acctno==t04.get_acctno())
{
j++;
break;
}
count++;
}
if(j!=0)
{
t4.deposit+=credit;
f4.seekp(count*sizeof(t4),ios::beg);
f4.write((char*) &t4 ,sizeof(t4));
}
else
{
cout<<"\nRecord NOT found";
}
cout<<"Your account balance is Rs "<>timeperiod;
rate=1.5*timeperiod;
interest=t5.deposit*timeperiod*(rate/100.0);
cout<<"\nInterest is Rs "<>crep;
if(crep=='y' || crep=='Y')
{
ofstream of;
cout<<"\nEnter 1 to change username or 2 to change password\n";
cin>>irep;
switch(irep)
{
case 1:
of.open("username.dat",ios::binary|ios::out);
cout<<"\nEnter new Username : ";
gets(cstr);
of.write((char*) &cstr,sizeof(cstr));
of.close();
break;
case 2:
of.open("password.dat",ios::binary|ios::out);
cout<<"\nEnter new password : ";
gets(cstr);
of.write((char*) &cstr,sizeof(cstr));
of.close();
break;
default:
goto l;
}
}
account obj;
int ch;
do
{
clrscr();
cout<<"\n\t\t\t ==========================";
cout<<"\n\t\t\t\t MAIN MENU";
cout<<"\n\t\t\t ==========================\n";
cout<<"\t1. Add record\n";
cout<<"\t2. View record\n";
cout<<"\t3. Update record / Transactions\n";
cout<<"\t4. Exit\n";
cout<<"\tEnter your choice: ";
cin>>ch;
clrscr();
int in=0;
switch(ch)
{
case 1:
obj.addnewrecord();
break;
case 2:
obj.viewrecord();
break;
case 3:
obj.updaterecord();
break;
case 4:
clrscr();
cout<<"\n\n\n\n\n\t\t\tSaving Your Settings";
for(in=0;in<6;in++)
{cout<<'.';delay(1500);}
clrscr();
cout<<"\n\n\n\n\n\t\t\t....Terminating....";
delay(2500);
exit(0);
default:
cout<<"\n\t\t\tinvalid entry!!!!";
cout<<"\n\n\t\t\t(Press any key..)";
getch();
break;
}
}while(ch<10);
}
``
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.