Академический Документы
Профессиональный Документы
Культура Документы
#include<conio.h>
#include<fstream>
#include<stdlib.h>
#include<iomanip>
#include<cctype>
#include<ctime>
#include<string>
bool isloggedin()
string username,password,un,pw;
cin>>username;
cin>>password;
ifstream read("record");
getline(read,un);
getline(read,pw);
return true;
else
return false;
}
}
class account
char name[50];
int deposit;
char type;
public:
void create_account();
void modify();
void dep(int);
void draw(int);
};
void time()
time_t now=time(0);
char* dt=ctime(&now);
cout<<"\t\t\t\t\t\t\t\t\t\t"<<dt<<endl;
}
void account::create_account()
cin>>acno;
cin.ignore();
cin.getline(name,50);
cin>>adhar;
cin>>mobile;
cin>>type;
type=toupper(type);
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin>>deposit;
cout<<"\n\n\nAccount Created..";
cout<<name;
void account::modify()
cin.ignore();
cin.getline(name,50);
cin>>adhar;
cin>>mobile;
cin>>type;
type=toupper(type);
cin>>deposit;
void account::dep(int x)
deposit+=x;
void account::draw(int x)
deposit-=x;
}
void account::report() const
return acno;
return deposit;
return type;
void write_account();
void display_sp(int);
void modify_account(int);
void delete_account(int);
void display_all();
int main()
int choice;
time();
cout<<"1: register";
cin>>choice;
if(choice==1)
string username,password;
cin>>username;
cin>>password;
ofstream file("record");
file<<username<<endl<<password;
file.close();
system("cls");
main();
else if(choice==2)
if(!status)
{
cout<<"\t\tEither user name or password entered is wrong "<<endl<<"\t\ttry
again "<<endl;
system("pause");
goto b;
return 0;
else
system("cls");
char ch;
int num;
do
system("cls");
time();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t08. EXIT";
cin>>ch;
system("cls");
switch(ch)
{
case '1':
write_account();
break;
case '2':
deposit_withdraw(num, 1);
break;
case '3':
deposit_withdraw(num, 2);
break;
case '4':
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
delete_account(num);
break;
case '7':
modify_account(num);
break;
case '8':
time();
break;
default :cout<<"\a";
cin.ignore();
cin.get();
while(ch!='8');
return 1;
void write_account()
time();
account ac;
ofstream outFile;
outFile.open("project.txt",ios::binary|ios::app);
ac.create_account();
outFile.close();
void display_sp(int n)
time();
account ac;
bool flag=false;
ifstream inFile;
inFile.open("project.txt",ios::binary);
if(!inFile)
return;
cout<<"\nBALANCE DETAILS\n";
if(ac.retacno()==n)
ac.show_account();
flag=true;
inFile.close();
if(flag==false)
void modify_account(int n)
time();
bool found=false;
account ac;
fstream File;
File.open("project.txt",ios::binary|ios::in|ios::out);
if(!File)
return;
if(ac.retacno()==n)
ac.show_account();
ac.modify();
int pos=(-1)*static_cast<int>(sizeof(account));//confusion
File.seekp(pos,ios::cur);
found=true;
File.close();
if(found==false)
void delete_account(int n)
time();
account ac;
ifstream inFile;
ofstream outFile;
inFile.open("project.txt",ios::binary);
if(!inFile)
return;
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
if(ac.retacno()!=n)
inFile.close();
outFile.close();
remove("project.txt");
rename("Temp.txt","project.txt");
void display_all()
time();
account ac;
ifstream inFile;
inFile.open("project.txt",ios::binary);
if(!inFile)
return;
cout<<"============================================================================
=\n";
cout<<"============================================================================
==\n";
ac.report();
inFile.close();
time();
int amt;
bool found=false;
account ac;
fstream File;
File.open("project.txt", ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
if(ac.retacno()==n)
cout<<"\n\tAccount status\n";
ac.show_account();
if(option==1)
cin>>amt;
ac.dep(amt);
if(option==2)
cin>>amt;
int bal=ac.retdeposit()-amt;
cout<<"Insufficience balance";
else
ac.draw(amt);
int pos=(-1)*static_cast<int>(sizeof(ac));
File.seekp(pos,ios::cur);
found=true;
File.close();
if(found==false)