Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream.h>
- #include<conio.h>
- #include<stdio.h>
- #include<process.h>
- #include<ctype.h>
- #include<string.h>
- //***************************************************************************
- // CLASS USE
- //***************************************************************************
- class account
- {
- int acno,deposit,withdraw,toupper;
- char name[50];
- char type;
- public:
- void create_account()
- { int no;
- cout<<"\n\n====NEW ACCOUNT ENTRY FORM====\n\n";
- cout<<"\nENTER THE ACCOUNT NUMBER:";
- cin>>no;
- cout<<"\nENTER THE NAME OF THE ACCOUNT HOLDER:";
- gets(name);
- cout<<"\nENTER TYPE OF THE ACCOUNT (C/S) :";
- cin>>type;
- cout<<"\nENTER INITIAL AMOUNT\n>=500 for Saving >=1000 for current :";
- cin>>deposit;
- cout<<"\n\n\nYour Account Created Successfully ..";
- }
- void show_account()
- {
- cout<<"\n\n----ACCOUNT STATUS----\n";
- cout<<"\nAccount No. : "<<acno;
- cout<<"\nAccount Holder Name:"<<name;
- cout<<"\nType of Account:"<<type;
- cout<<"\nBalance amount:"<<deposit;
- }
- void modify_account()
- { char type;
- int deposit;
- cout<<"\nAccount No. :"<<acno;
- cout<<"\nModify Account Holder Name:";
- gets(name);
- cout<<"\nModify Type Of Account:";cin>>type;
- cout<<"\nModify Balance amount:";cin>>deposit;
- }
- void dep(int x)
- {
- deposit+= x;
- }
- void draw(int x)
- {
- deposit-= x;
- }
- void report()
- {
- cout<<acno<<"\t"<<name<<"\t\t<<type<<"<<deposit<<endl;
- }
- {
- return acno;
- }
- float retdeposit()
- {
- return deposit;
- }
- char rettype()
- {
- }
- }; //class ends here
- //***************************************************************************
- // global decleration for stream object, object
- //***************************************************************************
- fstream fp;
- account ac;
- //***************************************************************************
- // function to write in file
- //***************************************************************************
- void write_account()
- {
- fp.open("account.dat",ios::in||ios::out);
- ac.create_account();
- fp.write((char*)&ac,sizeof(account));
- fp.close();
- }
- //***************************************************************************
- // function to read specific record in file
- //***************************************************************************
- void display_ap()
- {
- int n;
- cout<<"\n\n************BALANCE DETAILS****************";
- cout<<"\n\nEnter The Account Number: ";
- cin>>n;
- int flag=0;
- fp.open("account.dat",ios::in||ios::out);
- while(fp.read((char*)&ac,sizeof(account)))
- {
- if(ac.retacno()==n)
- {
- ac.show_account();
- flag=1;
- }
- }
- {
- fp.close();
- if(flag==0)
- cout<<"\n\nACOOUNT NUMBER DOES NOT EXIST";
- getch();
- }
- //**************************************************************************
- // function to modify record of file
- //***************************************************************************
- void modify_account()
- {
- int no, found=0;
- cout<<"\n\n************MODIFY RECORD******************";
- cout<<"\n\nENTER THE ACOOUNT NUMBER: ";
- cin>>no;
- fp.open("account.dat",ios::in|ios::out);
- while(fp.read((char*)&ac,sizeof(account)) && found==0;
- {
- if(ac.retacno()==no)
- {
- ac.show_account();
- cout<<"\n\n-----ENTER THE NEW DETAILS-----\N";
- ac.modify_account();
- int pos=1*sizeof(ac);
- fp.seekp(pos,ios::cur);
- fp.write((char*)&ac,sizeof(account));
- cout<<"\n\n\t RECORD UPDATED";
- found=1;
- }
- }
- fp.close();
- if(found==0)
- cout<<"\n\nRecord Not Found";
- getch();
- }
- //***************************************************************************
- // function to delete record of file
- //***************************************************************************
- void delete_account()
- {
- int no;
- cout<<"\n\n**********DELETE RECORD**********";
- cout<<"\n\nENTER THE ACOOUNT NO.:";
- cin>>no;
- fp.open("account.dat",ios::in||ios::out);
- fstream fp2;
- fp2.("Temp.dat",ios::out);
- fp.seekp(0,ios::bug);
- while(fp.read((char*)&ac,sizeof()))
- {
- if(ac.retacno() t=no)
- {
- fp2.write((char*)&ac,sizeof(account));
- }
- }
- close();
- fp.close();
- remove("account.dat");
- rename("Temp.dat","account.dat");
- cout<<"\n\nt RECORD DELETEC..";
- getch();
- }
- //***************************************************************************
- // function to display all accounts deposit list
- //***************************************************************************
- void display_all()
- {
- fp.open("acoount.dat",ios::in);
- if(!fp)
- {
- cout<<"ERROR!!! FILE COULD NOT BE OPEN";
- getch();
- return
- }
- cout<<"\n\n ACCOUNT HOLDER LIST\n\n";
- cout<<"=========================================================\n";
- cout<<"A/c no.\tNAME\t\tTYPE\t\tBALANCE\n";
- cout<<"=========================================================\n";
- while(fp.read((char*)&ac,sizeof(account)))
- {
- ac.report();
- }
- fp.close();
- getch();
- //***************************************************************************
- // function to deposit and withdraw ammounts
- //***************************************************************************
- void deposit_withdraw(int option)
- {
- int no,found=0,amt;
- cout<<"\n\n======ACCOUNT TRANSACTION FOR======";
- cout<<"\n\n ENTER THE ACCOUNT NO. :";
- cin>>no;
- fp.open("account.dat",ios::in|ios::out);
- while(fp.read((char*)&ac,sizeof(account)) && found==0;
- {
- if(ac.retacno()==no)
- ac.show_account();
- if(option==1)
- {
- cout<<"\n\n ENTER THE AMOUNT TO DEPOSIT:";
- cin>>amt;
- ac.dep();
- }
- if(option=2)
- {
- cout<<"\n\n ENTER THE AMOUNT TO WITHDRAW:";
- cin>>amt;
- int bal=ac.retdeposit()-amt;
- if(bal<500 &&ac.rettype()=='S') || (bal<1500 && ac.rettype()=='C'))
- cout<<"\n INUSUFICIENCE BALANACE";
- else
- ac.draw(amt);
- }
- int pos=-1*sizeof(ac);
- fp.seekp(pos,ios::cur);
- fp.write((char*)&ac,sizeof(account));
- cout<<"\n\nt RECORD UPDATED";
- found=1;
- }
- }
- {
- fp.close();
- if(found==0)
- cout<<"\n\n RECORD NOT FOUND";
- getch();
- }
- //***************************************************************************
- // INTRODUCTION FUNCTION
- //***************************************************************************
- void intro()
- {
- clrscr();
- textbackground(BLACK);
- gotoxy(25,7)
- cout<<"===========================================================";
- gotoxy(15,11);
- cout<<"BANK";
- gotoxy(23,14)
- cout<<"MANAGEMENT";
- gotoxy(25,17)
- cout<<"SYSTEM";
- gotoxy(25,21);
- cout<<"===========================================================";
- gotoxy(25,24);
- cout<<"MADE BY : ADMINISTRATOR";
- gotoxy(25,24);
- cout<<"SCHOOL : AICS";
- getch();
- }
- //***************************************************************************
- // THE MAINFUNCTION OF PROGRAM
- //***************************************************************************
- void main()
- {
- char ch;
- char pass,ox;
- char password[100],passv[100],userid[100];
- INT I= 0,counter =0;
- do
- {
- clrscr();
- gotoxy(32,15);
- cout<<"Enter Username:";
- gotoxy(32,18)
- cout<<"Enter Passwod:";
- cout<<" ";
- while(1)
- {
- pass=getch();
- if(pass==11)
- {
- break;
- }
- if (pass==8)
- {
- putch("\b");
- putch(NULL);
- putch("\b");
- --1;
- continue;
- }
- if (pass<='7' &&pass >='1'|| pass>='a' && pass<='a' || pass>='A' && pass<='A')
- {
- passv[i++]=pass;
- cout<<"*";
- else
- continue;
- }
- cout<<"\n\n";
- passv='\n';
- if((strcmp)(Userid, "admin")== 0 && strcmp(passv,"admin") ==0 )
- {
- textcolor(YELLOW);
- gotoxy(32,22);
- cout<<"Login Success";
- gotoxy(32,25);
- cout<<"Press any ket to continue";
- getch();
- goto A;
- }
- else
- {
- gotoxy(32,21);
- cout<<"Invalid username or password";
- i=0;
- counter++;
- if(counter ==3)
- {
- clrscr();
- gotoxy(32,22);
- cout<<"Try again later";
- getch();
- }
- else
- {
- gotoxy(32,23)
- cout<<"Try again[y/n]";
- cin>>ex;
- }
- }
- }
- while(ex=='y' || ex=='Y');
- exit(0);
- A:
- intro();
- do
- {
- gotoxy(52,3);
- cout<<"[D] Delete";
- gotoxy(63,3);
- cout<<"[Q]QUIT";
- gotoxy(5,3);
- cout<<"Option";
- }
- void Inv::intToStr(){
- int i=0;
- if(Itemno>99){
- Itemno-= 100; i++;
- } CItemno[0]=i + '0'; 1=0;
- while(Itemno>9){
- Itemno-= 10; i++;
- } CItemno[1]=i + '0'; 1=0;
- CItemno[2]=Itemno+'0'; i=0;
- if(Quantity>99){
- Quantity-= 100; i++;
- }CQuantity[0]=i+'0'; i=0;
- while(Quantity>9){
- Quantity-=10; i++;
- }CQuantity[1]=i+'0';
- CQuantity[2]=Quantity+'0'; i=0;
- if(Price>999){ Price-=1000; i++; }CPrice[0]=i+'0'; i=0;
- while(Price>99){ Price-=100;i++;}CPrice[1]=i+'0'; i=0;
- while(Price>9){ Price-=10;i++;}CPrice[2]=i+'0';
- {
- CPrice[3]=Price+'0';i=0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement