└── OOP PROJECT ├── real ├── New folder │ ├── Banking Record System(Report)..docx │ ├── README.md │ ├── Untitled1.cpp │ └── customer_end.h ├── realmain.cpp ├── Customer_end.h ├── account.h └── customer_end2.h ├── New folder ├── ch.h ├── s.h ├── ch.cpp ├── a.h ├── main.cpp ├── s.cpp └── a.cpp ├── Bank-Management-System-master └── README.md ├── pro remaing things.txt ├── PROJECT ├── project.cpp ├── Bank-Management-System-main │ ├── project.cpp │ └── ATM.h ├── test2.cpp ├── banking record system.cpp ├── employees_end.h ├── main.cpp ├── project.h ├── project2.cpp ├── BankManagement.cpp └── customer_end2.h ├── loan.cpp ├── RBMS - Copy ├── insurance.h ├── loan.h └── ATM.h ├── BANK.cpp ├── Untitled1.cpp ├── Bank_Management_system ├── Admin_end.h ├── customer_end.h ├── employees_end.cpp ├── main.cpp ├── customer_end.cpp ├── project.h └── ATM.cpp └── new.h /OOP PROJECT/real/New folder/Banking Record System(Report)..docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mustafa-Hassan2001/BMS/HEAD/OOP PROJECT/real/New folder/Banking Record System(Report)..docx -------------------------------------------------------------------------------- /OOP PROJECT/New folder/ch.h: -------------------------------------------------------------------------------- 1 | #include "a.h" 2 | 3 | class Checking: public Account { 4 | 5 | public: 6 | 7 | Checking(double newBalance); 8 | 9 | double withdrawal(double); 10 | double deposit(double); 11 | }; 12 | -------------------------------------------------------------------------------- /OOP PROJECT/Bank-Management-System-master/README.md: -------------------------------------------------------------------------------- 1 | # Bank Management System [C++] 2 | C++ Project of Bank Management System, Here, you can create a new account, update information of an existing account, view and manage transactions, check the details of an existing account, remove existing account and view customers list. 3 | 4 | Happy Learning... 5 | -------------------------------------------------------------------------------- /OOP PROJECT/New folder/s.h: -------------------------------------------------------------------------------- 1 | #include "a.h" 2 | 3 | class Savings: public Account { 4 | 5 | public: 6 | 7 | Savings(double newBalance, double newInterestRate); 8 | 9 | double withdrawal(double amount); 10 | double deposit(double amount); 11 | 12 | 13 | protected: 14 | 15 | double getRate() const; 16 | double setRate(); 17 | 18 | private: 19 | 20 | double interestRate; 21 | 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /OOP PROJECT/pro remaing things.txt: -------------------------------------------------------------------------------- 1 | structure 2 | 3 | pointers 4 | 5 | bool 6 | 7 | const int* const 8 | 9 | int *const 10 | 11 | new 12 | 13 | delete 14 | 15 | class POLBILL *obj1 = new POLBILL; 16 | 17 | void set_vehicle(){ 18 | vehicle = new string; 19 | } 20 | void set_fuelcon(){ 21 | fuelcon = new int; 22 | } 23 | 24 | static data member & function 25 | 26 | b:p e, p atm multiplr inheritance 27 | 28 | FRIND CLASS & FRIEND FUNCTION 29 | 30 | Nested Class 31 | 32 | enum 33 | 34 | typedef unsigned int p_int; -------------------------------------------------------------------------------- /OOP PROJECT/New folder/ch.cpp: -------------------------------------------------------------------------------- 1 | #include "checking.h" 2 | 3 | Checking::Checking(double newBalance): Account(balance) 4 | { 5 | 6 | Account::setBalance(balance); 7 | } 8 | 9 | double Checking::withdrawal(double amount) 10 | { 11 | if ( Account::getBalance() - amount >= 0) 12 | { 13 | Account::withdrawal(amount); 14 | } 15 | else 16 | { 17 | cout << "Not enough funds in checking for transaction" << endl << endl; 18 | } 19 | } 20 | 21 | double Checking::deposit(double amount) 22 | { 23 | Account::deposit(amount); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /OOP PROJECT/New folder/a.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | class Accounts 7 | { 8 | public: 9 | Accounts(); 10 | ~Accounts(); 11 | virtual void WithDraw(int) = 0; 12 | virtual void Deposit(int, string, int, int) = 0;//Also can be named as add Account 13 | virtual void Balance() {}; 14 | virtual void DeleteAccount(int)=0; 15 | virtual int getAccountsNumber()=0; 16 | }; 17 | //Definning classes methods 18 | Accounts::Accounts() 19 | { 20 | cout << "\nThe Accounts class started\n"; 21 | //no need to initialize vectors.They work perfect without initializing.C++ has done work for it 22 | } 23 | Accounts::~Accounts() 24 | { 25 | cout << "\nThe Accounts class Ended\n"; 26 | } 27 | -------------------------------------------------------------------------------- /OOP PROJECT/New folder/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "ch.h" 7 | #include "s.h" 8 | //#include "moneymarket.h" 9 | //#include "certificatedeposit.h" 10 | 11 | using namespace std; 12 | 13 | void main 14 | { 15 | //declare all 4 types, call withdrawl, deposit, 16 | //and transfer from on each account 17 | 18 | Checking Brad (200); 19 | Savings Brad (100); 20 | 21 | Checking Jessi (10000); 22 | Savings Jessi (10); 23 | 24 | cout << "Brad's Checking balance: " << Brad->Checking::getBalance() << endl << endl; 25 | 26 | cout << "Brad's Saving balance: " << Brad->Saving::getBalance() << endl << endl; 27 | 28 | cout << "Jessi's Checking balance: " << Jessi->Checking::getBalance() << endl << endl; 29 | 30 | cout << "Jessi's Savings balance: " << Jessi->Savings::getBalance() << endl << endl; 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /OOP PROJECT/real/New folder/README.md: -------------------------------------------------------------------------------- 1 | # Bank-Management-System 2 | 3 | 4 | Aim: 5 | To develop a C++ program for Bank Management System using Object Oriented Programming concepts such as Class and Object, Switch case, File Handling. 6 | 7 | Objective: 8 | To explore principles of programming. 9 | To use the object oriented paradigm in program design. 10 | To lay foundation to advanced programming. 11 | 12 | Essential Information required for the implementation of the program: 13 | 14 | Bank: 15 | A bank is a financial institution licensed to receive deposits and make loans. Banks may also provide financial services such as wealth management, currency exchange, and safe deposit boxes. 16 | 17 | Project: 18 | This project provides the following functionalities: 19 | 20 | 1. Create new Account 21 | 2. Deposit amount to Account 22 | 3. Withdraw amount from Account 23 | 4. Balance Enquiry 24 | 5. Display list of Account Holders 25 | 6. Delete an Account 26 | 7. Modify the existing Account 27 | 28 | 29 | 30 | Source Code: 31 | -------------------------------------------------------------------------------- /OOP PROJECT/PROJECT/project.cpp: -------------------------------------------------------------------------------- 1 | #include "project.h" 2 | #include 3 | #include //for system cls and sleep and goto back: functions. 4 | #include 5 | 6 | 7 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 8 | 9 | using namespace std; 10 | 11 | int main(){ 12 | cout<<"\n\t\t***************WELCOME TO WITHOUT MY INTEREST BANK*************\n\n"; 13 | 14 | string name,id,address; 15 | string username,password; 16 | 17 | cout<<"\n\n\t\t\t******Signup******"<>username; 20 | cout<<"\t\t\tEnter new password: "; 21 | cin>>password; 22 | cout<<"\t\t\tYour new id is creating please wait"; 23 | for(int i=0;i<6;i++){ 24 | cout<<"."; 25 | Sleep(500); 26 | } 27 | cout<<"\n\t\t\tYour id created successfully"; 28 | Sleep(2000); 29 | 30 | system("CLS"); 31 | string usrn,pswd; 32 | 33 | start: 34 | cout<<"\n\n\t\t\t LOGIN"<>usrn; 37 | cout<<"\t\t\tEnter password: "; 38 | cin>>pswd; 39 | if(usrn==username&&pswd==password){ 40 | system("CLS"); 41 | Bank b; 42 | b.choice(); 43 | char ch; 44 | } 45 | else if(pswd!=password){ 46 | cout<<"\t\t\tInvaid Password\n"< 3 | #include 4 | 5 | using namespace std; 6 | 7 | class mortgagePayment { 8 | public: 9 | void Mortgage(); 10 | void display(); 11 | 12 | 13 | private: 14 | double tPayment(double principle, double term, double interest); 15 | }; 16 | 17 | 18 | double mortgagePayment::tPayment(double principle, double term, double interest) { 19 | term = 0; 20 | int years = term *12; 21 | double monthlyInterest = interest/12/100; 22 | double total = (principle * monthlyInterest)/(1-pow(1 + monthlyInterest, -years)); //total for mortgage 23 | return(total); 24 | } 25 | 26 | void mortgagePayment::Mortgage() { 27 | double principle = 0; 28 | double rate = 0; 29 | int term = 0; 30 | double total = 0; 31 | 32 | cout << "Please enter Loan amount: "; 33 | cin >> principle; 34 | cout << "Please enter desired interest rate: "; 35 | cin >> rate; 36 | cout << "Please enter term: "; 37 | cin >> term; 38 | cout << "Your total monthly payment is: $" <> ch; 53 | 54 | if (ch != 'y') { 55 | Exit = true; 56 | } 57 | } 58 | } 59 | 60 | int main(){ 61 | mortgagePayment m; 62 | m.Mortgage(); 63 | m.display(); 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /OOP PROJECT/New folder/s.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "savings.h" 5 | 6 | 7 | 8 | //-------------------------------------------------------------------------------------- 9 | 10 | Savings::Savings(double balance, double interestRate) : Account(balance) 11 | { 12 | Account::setBalance(balance); 13 | setRate(interestRate); 14 | } 15 | 16 | //-------------------------------------------------------------------------------------- 17 | 18 | void Savings::setRate(double interest) 19 | { 20 | interestRate = interest; 21 | interestRate = (interestRate/100)/12; // to get interest in monthly format 22 | } 23 | //-------------------------------------------------------------------------------------- 24 | 25 | double Savings::getRate() const 26 | { 27 | return interestRate; 28 | } 29 | 30 | //-------------------------------------------------------------------------------------- 31 | 32 | double Savings::withdrawal(double amount) 33 | { 34 | if ( (Account::getBalance() - amount) >= 0) 35 | { 36 | Account::withdrawal(amount); 37 | Account::setBalance(Account::getBalance() + ( interestRate * Account::getBalance() ) ); 38 | } 39 | else 40 | { 41 | cerr << "Not enough funds in savings for transaction" << endl << endl; 42 | } 43 | } 44 | 45 | //-------------------------------------------------------------------------------------- 46 | 47 | double Savings::deposit(double amount) 48 | { 49 | Account::deposit(amount); 50 | Account::setBalance(Account::getBalance() + ( interestRate * Account::getBalance() ) ); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /OOP PROJECT/New folder/a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "account.h" 5 | 6 | using namespace std; 7 | 8 | //---------------------------------------------------------------------------------------------------- 9 | 10 | Account::Account(double newBalance) 11 | { 12 | if (newBalance > 0) 13 | { 14 | balance = newBalance; 15 | } 16 | else 17 | { 18 | cerr << "Illegal Balance" << endl << endl; 19 | } 20 | } 21 | //---------------------------------------------------------------------------------------------------- 22 | 23 | double Account::getBalance() const 24 | { 25 | return balance; 26 | } 27 | //---------------------------------------------------------------------------------------------------- 28 | 29 | void Account::setBalance(double newBalance) 30 | { 31 | if (newBalance > 0) 32 | { 33 | balance = newBalance; 34 | } 35 | else 36 | { 37 | cerr << "Illegal Balance" << endl << endl; 38 | } 39 | } 40 | //---------------------------------------------------------------------------------------------------- 41 | 42 | double Account::deposit(double amount) 43 | { 44 | if (amount >= 0) 45 | { 46 | balance = balance + amount; 47 | } 48 | else 49 | { 50 | cerr << "Illegal deposit" << endl << endl; 51 | } 52 | return balance; 53 | 54 | 55 | } 56 | //---------------------------------------------------------------------------------------------------- 57 | 58 | double Account::withdrawal(double amount) 59 | { 60 | if (amount > 0) 61 | { 62 | balance = balance - amount; 63 | } 64 | else 65 | { 66 | cerr << "Illegal withdrawal" << endl << endl; 67 | } 68 | return balance; 69 | } 70 | //---------------------------------------------------------------------------------------------------- 71 | 72 | double Account::transferFrom(char* accountTrans, double moneyTrans) 73 | { 74 | accountTrans->balance = accountTrans->balance - moneyTrans; 75 | this->balance = this->balance + moneyTrans; 76 | return balance; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /OOP PROJECT/RBMS - Copy/insurance.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | class Insurance{ 6 | public: 7 | string name; 8 | string dob; 9 | string address; 10 | string gender; 11 | int years; 12 | int age; 13 | int cinc; 14 | int sd; 15 | int ed; 16 | void meun(); 17 | void Register(){ 18 | cout<<"\t\t\tEnter your name : "; 19 | cin>>name; 20 | cout<<"\t\t\tEnter your Address : "; 21 | cin>>address; 22 | cout<<"\t\t\tEnter your gender : "; 23 | cin>>gender; 24 | cout<<"\t\t\tEnter your Date of Birth : "; 25 | cin>>dob; 26 | cout<<"\t\t\tEnter your age : "; 27 | cin>>age; 28 | cout<<"\t\t\tEnter your CNIC : "; 29 | cin>>cinc; 30 | cout<<"\t\t\tEnter number of years : "; 31 | cin>>years; 32 | cout<<"\t\t\tEnter Date For When Policy To Be Effective: "; 33 | cin>>sd; 34 | cout<<"\t\t\tEnter Date For When Policy To Be Expiry: "; 35 | cin>>ed; 36 | } 37 | void monthlyins(){ 38 | int mon_ins = 5000/years; 39 | cout<<"\n\t\t\tYOUR MONTHLY INSTALMENT = "<>Vehicle_num; 49 | // return Bill_num; 50 | } 51 | //start of nested class declaration 52 | 53 | class Engine{ 54 | 55 | public: 56 | string Enginecc; 57 | int get_Enginecc(){ 58 | cout<<"\t\t\tCar Engine Specifications are : "; 59 | cin>>Enginecc; 60 | // return Enginecc; 61 | }//declaration nested class ends here 62 | void inu(){ 63 | cout<<"\t\t\tFor Vehicle Insurance your monthly instalment is 5000/= Rupees "; 64 | } 65 | }; 66 | Engine Enginecc; 67 | }; 68 | 69 | void meun(){ 70 | Insurance i; 71 | Vehicle_Insurance *obj1 = new Vehicle_Insurance(); 72 | i.Register(); 73 | obj1->get_Vehicle_num(); 74 | obj1->Enginecc.get_Enginecc(); 75 | obj1->Enginecc.inu(); 76 | i.monthlyins(); 77 | delete obj1; 78 | // return 0; 79 | } 80 | -------------------------------------------------------------------------------- /OOP PROJECT/BANK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | class Insurance{ 6 | public: 7 | string name; 8 | string dob; 9 | string address; 10 | string gender; 11 | int years; 12 | int age; 13 | int cinc; 14 | int sd; 15 | int ed; 16 | void meun(); 17 | void Register(){ 18 | cout << "\n\t\t\t\t\t----------------------------------" << endl; 19 | cout << "\t\t\t\t\t\t>> APPLYING FORM <<" << endl; 20 | cout << "\t\t\t\t\t-----------------------------------" << endl; 21 | cout<>name; 24 | cout<<"\t\t\tEnter your Address : "; 25 | cin>>address; 26 | cout<<"\t\t\tEnter your gender : "; 27 | cin>>gender; 28 | cout<<"\t\t\tEnter your Date of Birth : "; 29 | cin>>dob; 30 | cout<<"\t\t\tEnter your age : "; 31 | cin>>age; 32 | cout<<"\t\t\tEnter your CNIC : "; 33 | cin>>cinc; 34 | cout<<"\t\t\tEnter number of years : "; 35 | cin>>years; 36 | cout<<"\t\t\tEnter Date For When Policy To Be Effective: "; 37 | cin>>sd; 38 | cout<<"\t\t\tEnter Date For When Policy To Be Expiry: "; 39 | cin>>ed; 40 | } 41 | void monthlyins(){ 42 | int mon_ins = 5000/years; 43 | cout<<"\n\t\t\tYOUR MONTHLY INSTALMENT = "<>Vehicle_num; 53 | // return Bill_num; 54 | } 55 | //start of nested class declaration 56 | 57 | class Engine{ 58 | 59 | public: 60 | string Enginecc; 61 | int get_Enginecc(){ 62 | cout<<"\t\t\tCar Engine Specifications are : "; 63 | cin>>Enginecc; 64 | // return Enginecc; 65 | }//declaration nested class ends here 66 | void inu(){ 67 | cout<<"\t\t\tFor Vehicle Insurance your monthly instalment is 5000/= Rupees "; 68 | } 69 | }; 70 | Engine Enginecc; 71 | }; 72 | 73 | int main(){ 74 | Insurance i; 75 | Vehicle_Insurance *obj1 = new Vehicle_Insurance(); 76 | i.Register(); 77 | obj1->get_Vehicle_num(); 78 | obj1->Enginecc.get_Enginecc(); 79 | obj1->Enginecc.inu(); 80 | i.monthlyins(); 81 | delete obj1; 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /OOP PROJECT/real/realmain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Employee_end.h" 3 | #include "customer_end2.h" 4 | #include "ATM.h" 5 | #include "new.h" 6 | #include //for system cls and sleep and goto back: functions. 7 | #include 8 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 9 | 10 | using namespace std; 11 | 12 | //class Bank{ 13 | //int banking() = 0; 14 | //}; 15 | 16 | int main(){ 17 | cout<<"\n\t\t***************WELCOME TO WITHOUT MY INTEREST BANK*************\n\n"; 18 | 19 | string name,id,address; 20 | string username,password; 21 | 22 | cout<<"\n\n\t\t\t******Signup******"<>username; 25 | cout<<"\t\t\tEnter new password: "; 26 | cin>>password; 27 | cout<<"\t\t\tYour new id is creating please wait"; 28 | for(int i=0;i<6;i++){ 29 | cout<<"."; 30 | Sleep(500); 31 | } 32 | cout<<"\n\t\t\tYour id created successfully"; 33 | Sleep(2000); 34 | 35 | system("CLS"); 36 | string usrn,pswd; 37 | 38 | start: 39 | cout<<"\n\n\t\t\t LOGIN"<>usrn; 42 | cout<<"\t\t\tConfirm password: "; 43 | cin>>pswd; 44 | system("cls"); 45 | if(usrn==username&&pswd==password){ 46 | cout << "\n\t\t\t\t\t-------------------------------" << endl; 47 | cout << "\t\t\t\t\t>> BANK MANAGEMNET SYSTEM <<" << endl; 48 | cout << "\t\t\t\t\t-------------------------------" << endl; 49 | cout << "\t\t\t\t\t 1. Employee End" << endl; 50 | cout << "\t\t\t\t\t 2. ATM" << endl; 51 | cout << "\t\t\t\t\t 3. Customer End" << endl; 52 | cout << "\t\t\t\t\t 4. Exit" << endl; 53 | cout << "\t\t\t\t\t.................................." << endl; 54 | cout << "\t\t\t\t\t>> Choice Options: [1/2/3] <<" << endl; 55 | cout << "\t\t\t\t\t.................................." << endl; 56 | cout << "\t\t\t\t\t Enter Your Choice: "; // Taking the action input 57 | cin>>opt; 58 | if(opt==1){ 59 | Employee_management e; 60 | e.menu(); 61 | } 62 | else if(opt==2){ 63 | atm a; 64 | a.add_user(); 65 | } 66 | else if(opt==3){ 67 | account acc; 68 | acc.MENU(); 69 | } 70 | } 71 | else if(pswd!=password){ 72 | cout<<"\t\t\tInvaid Password\n"< 2 | #include 3 | using namespace std; 4 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 5 | 6 | //Topic#1->FRIND CLASS & FRIEND FUNCTION 7 | 8 | class client; 9 | 10 | class Agent{ 11 | protected: 12 | static int AWallet_Amount; 13 | public: 14 | Agent(int WAM){ 15 | AWallet_Amount=WAM; 16 | cout<>name; 63 | cout<>age; 65 | cout<>gender; 67 | cout<>address; 69 | cout<>cnic; 71 | cout<>a; 74 | Agent ObjPm(a); 75 | cout<>c; 79 | ObjGPm.Give_PM(c); 80 | cout<>f; 84 | shopkeeper(f); 85 | cout< 2 | #include "Admin.h" 3 | #include "Employee_end.h" 4 | #include "ATM.h" 5 | #include //for system cls and sleep and goto back: functions. 6 | #include 7 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 8 | 9 | using namespace std; 10 | 11 | int main(){ 12 | int opt; 13 | // cout<<"\n\n\t\t================================================================================="<>username; 22 | // cout<<"\t\t\t\t\t\tEnter new password : "; 23 | // cin>>password; 24 | // cout<<"\t\t\t\t\tYour new id is creating please wait"; 25 | // for(int i=0;i<4;i++){ 26 | // cout<<"."; 27 | // Sleep(400); 28 | // } 29 | // cout<<"\n\t\t\t\t\tYour id created successfully"<>usrn; 41 | // cout<<"\t\t\t\t\t\t Enter password: "; 42 | // cin>>pswd; 43 | // cout<> BANK MANAGEMNET SYSTEM <<" << endl; 51 | cout << "\t\t\t\t\t-------------------------------" << endl; 52 | cout << "\t\t\t\t\t 1. Employee End" << endl; 53 | cout << "\t\t\t\t\t 2. Customer End" << endl; 54 | cout << "\t\t\t\t\t 3. ATM" << endl; 55 | cout << "\t\t\t\t\t 4. Exit" << endl; 56 | cout << "\t\t\t\t\t.................................." << endl; 57 | cout << "\t\t\t\t\t>> Choice Options: [1/2/3] <<" << endl; 58 | cout << "\t\t\t\t\t.................................." << endl; 59 | cout << "\t\t\t\t\t Enter Your Choice: "; // Taking the action input 60 | cin>>opt; 61 | if(opt==1){ 62 | // Employee_end e; 63 | // e.menu(); 64 | } 65 | else if(opt==2){ 66 | A.logscreen(); 67 | } 68 | else if(opt==3){ 69 | atm a; 70 | a.add_user(); 71 | } 72 | else if(opt==4){ 73 | cout<<"\n\n\t\t\t\t\tHave a nice day...Thank you!!"< 2 | using namespace std; 3 | //Bank Management System using Class & inheritance in C++ 4 | /* 5 | 1.Saving Account 6 | 2.current Account 7 | 8 | Account Creation 9 | Deposit 10 | Withdraw 11 | Balance 12 | 13 | */ 14 | class account 15 | { 16 | private: 17 | string name; 18 | int accno; 19 | string atype; 20 | public: 21 | void getAccountDetails() 22 | { 23 | cout<<"\nEnter Customer Name : "; 24 | cin>>name; 25 | cout<<"Enter Account Number : "; 26 | cin>>accno; 27 | cout<<"Enter Account Type : "; 28 | cin>>atype; 29 | } 30 | void displayDetails() 31 | { 32 | cout<<"\n\nCustomer Name : "<>deposit; 51 | balance = balance + deposit; 52 | } 53 | void c_withdraw() 54 | { 55 | float withdraw; 56 | cout<<"\n\nBalance : "<>withdraw; 59 | if(balance > 1000) 60 | { 61 | balance=balance-withdraw; 62 | cout<<"\nBalance Amount After Withdraw: "<>deposit; 88 | sav_balance = sav_balance + deposit; 89 | interest=(sav_balance*2)/100; 90 | sav_balance=sav_balance+interest; 91 | } 92 | void s_withdraw() 93 | { 94 | float withdraw; 95 | cout<<"\nBalance :- "<>withdraw; 98 | if(sav_balance > 500) 99 | { 100 | sav_balance=sav_balance-withdraw; 101 | cout<<"\nBalance Amount After Withdraw: "<>type; 119 | int choice; 120 | if(type=='s' || type=='S') 121 | { 122 | s1.getAccountDetails(); 123 | while(1) 124 | { 125 | cout<<"\nChoose Your Choice"<>choice; 133 | switch(choice) 134 | { 135 | case 1 : 136 | s1.s_deposit(); 137 | break; 138 | case 2 : 139 | s1.s_withdraw(); 140 | break; 141 | case 3 : 142 | s1.s_display(); 143 | break; 144 | case 4 : 145 | s1.displayDetails(); 146 | s1.s_display(); 147 | break; 148 | case 5 : 149 | goto end; 150 | default: 151 | cout<<"\n\nEntered choice is invalid,\"TRY AGAIN\""; 152 | } 153 | } 154 | } 155 | else if(type=='c' || type=='C') 156 | { 157 | c1.getAccountDetails(); 158 | while(1) 159 | { 160 | cout<<"\nChoose Your Choice"<>choice; 168 | switch(choice) 169 | { 170 | case 1 : 171 | c1.c_deposit(); 172 | break; 173 | case 2 : 174 | c1.c_withdraw(); 175 | break; 176 | case 3 : 177 | c1.c_display(); 178 | break; 179 | case 4 : 180 | c1.displayDetails(); 181 | c1.c_display(); 182 | break; 183 | case 5 : 184 | goto end; 185 | default: 186 | cout<<"\n\nEntered choice is invalid,\"TRY AGAIN\""; 187 | } 188 | } 189 | } 190 | else 191 | { 192 | cout<<"\nInvalid Account Selection"; 193 | } 194 | end: 195 | cout<<"\nThank You for Banking with us.."; 196 | return 0; 197 | } 198 | -------------------------------------------------------------------------------- /OOP PROJECT/real/New folder/Untitled1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | ////Personal information 5 | //struct Personal_information{ 6 | //char email[20]; 7 | //char address[20]; 8 | //char Education[20]; 9 | //int age; 10 | //int phone_number; 11 | //}; 12 | // 13 | ////Professional information 14 | //struct Professional_information{ 15 | //float salary; 16 | //int ID; 17 | //char company_name[20]; 18 | //int working_experience; 19 | //int working_hours; 20 | //}; 21 | // 22 | ////Baank information 23 | //struct Bank_information{ 24 | //int Acc_number; 25 | //char ac_email[20]; 26 | //char Bank_name[20]; 27 | //int balance; 28 | //int credit_card; 29 | //}; 30 | 31 | //National record 32 | 33 | struct National_record{ 34 | 35 | char Nationality[20]; 36 | char Gender[20]; 37 | int Cnic; 38 | char Religion[20]; 39 | char name[20]; 40 | 41 | //Personal information 42 | struct Personal_information{ 43 | char email[20]; 44 | char address[20]; 45 | char Education[20]; 46 | int age; 47 | int phone_number; 48 | }; 49 | 50 | //Professional information 51 | struct Professional_information{ 52 | float salary; 53 | int ID; 54 | char company_name[20]; 55 | int working_experience; 56 | int working_hours; 57 | }; 58 | 59 | //Baank information 60 | struct Bank_information{ 61 | int Acc_number; 62 | char ac_email[20]; 63 | char Bank_name[20]; 64 | int balance; 65 | int credit_card; 66 | 67 | 68 | }; 69 | struct Personal_information Pers; 70 | struct Professional_information Prof; 71 | struct Bank_information Acinfo; 72 | }; 73 | 74 | int main(){ 75 | National_record nat[2]; 76 | int i; 77 | 78 | for(i=0;i<2;i++){ 79 | 80 | cout<<"National record of client No."<>nat[i].name,19; 85 | 86 | cout<<"Enter CNIC:"; 87 | cin>>nat[i].Cnic; 88 | 89 | cout<<"Enter Gender:"; 90 | cin>>nat[i].Gender,19; 91 | 92 | cout<<"Enter Nationality:"; 93 | cin>>nat[i].Nationality,19; 94 | 95 | cout<<"Enter Religion:"; 96 | cin>>nat[i].Religion,19; 97 | 98 | //Personal information of client 99 | cout<<"Personal record of client No."<>nat[i].Pers.address,19; 103 | 104 | cout<<"Enter Age:"; 105 | cin>>nat[i].Pers.age; 106 | 107 | cout<<"Enter Education:"; 108 | cin>>nat[i].Pers.Education,19; 109 | 110 | cout<<"Enter Email:"; 111 | cin>>nat[i].Pers.email,19; 112 | 113 | cout<<"Enter Phone number:"; 114 | cin>>nat[i].Pers.phone_number; 115 | 116 | //Professional information of client 117 | cout<<"Professional record of client No."<>nat[i].Prof.ID; 121 | 122 | cout<<"Enter Working experience:"; 123 | cin>>nat[i].Prof.working_experience; 124 | 125 | cout<<"Enter Company name:"; 126 | cin>>nat[i].Prof.company_name,19; 127 | 128 | cout<<"Enter working hours:"; 129 | cin>>nat[i].Prof.working_hours; 130 | 131 | cout<<"Enter salary:"; 132 | cin>>nat[i].Prof.salary; 133 | 134 | //Bank Information of Client 135 | cout<<"Bank record of client No."<>nat[i].Acinfo.Acc_number; 138 | cout<<"Enter Bank name:"; 139 | cin>>nat[i].Acinfo.Bank_name,19; 140 | 141 | cout<<"Enter Balance:"; 142 | cin>>nat[i].Acinfo.balance; 143 | 144 | cout<<"Enter Bank email:"; 145 | cin>>nat[i].Acinfo.ac_email,19; 146 | 147 | cout<<"Enter ATM card number:"; 148 | cin>>nat[i].Acinfo.credit_card; 149 | 150 | cin.get(); 151 | } 152 | 153 | cout< 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | class Admin{ 7 | private: 8 | string account_number; 9 | string firstName; 10 | string lastName; 11 | string date_of_opening; 12 | string address; 13 | string statius; 14 | float total_Balance; 15 | double CNIC; 16 | public: 17 | // Admin(){ 18 | void read_data(); 19 | void show_data(); 20 | void write_rec(); 21 | void read_rec(); 22 | void search_rec(); 23 | void edit_rec(); 24 | void delete_rec(); 25 | int maniu(); 26 | // } 27 | }; 28 | void Admin::read_data() 29 | { 30 | cout<<"\nEnetr Date: "; 31 | cin>>date_of_opening; 32 | cout<<"Enter Account Number: "; 33 | cin>>account_number; 34 | cout<<"Enter First Name: "; 35 | cin>>firstName; 36 | cout<<"Enter Last Name: "; 37 | cin>>lastName; 38 | cout<<"Enter CNIC: "; 39 | cin>>CNIC; 40 | cout<<"Enter Address: "; 41 | cin>>address; 42 | cout<<"Enter your statius: "; 43 | cin>>statius; 44 | cout<<"Enter Balance: "; 45 | cin>>total_Balance; 46 | cout<(this), sizeof(*this)); 66 | outfile.close(); 67 | } 68 | void Admin::read_rec() 69 | { 70 | ifstream infile; 71 | infile.open("record.bank", ios::binary); 72 | if(!infile) 73 | { 74 | cout<<"Error in Opening! File Not Found!!"<(this), sizeof(*this))>0) 81 | { 82 | show_data(); 83 | } 84 | } 85 | infile.close(); 86 | } 87 | void Admin::search_rec() 88 | { 89 | int n; 90 | ifstream infile; 91 | infile.open("record.bank", ios::binary); 92 | if(!infile) 93 | { 94 | cout<<"\nError in opening! File Not Found!!"<>n; 102 | infile.seekg((n-1)*sizeof(*this)); 103 | infile.read(reinterpret_cast(this), sizeof(*this)); 104 | show_data(); 105 | } 106 | void Admin::edit_rec() 107 | { 108 | int n; 109 | fstream iofile; 110 | iofile.open("record.bank", ios::in|ios::binary); 111 | if(!iofile) 112 | { 113 | cout<<"\nError in opening! File Not Found!!"<>n; 121 | iofile.seekg((n-1)*sizeof(*this)); 122 | iofile.read(reinterpret_cast(this), sizeof(*this)); 123 | cout<<"Record "<(this), sizeof(*this)); 131 | } 132 | void Admin::delete_rec() 133 | { 134 | int n; 135 | ifstream infile; 136 | infile.open("record.bank", ios::binary); 137 | if(!infile) 138 | { 139 | cout<<"\nError in opening! File Not Found!!"<>n; 147 | fstream tmpfile; 148 | tmpfile.open("tmpfile.bank", ios::out|ios::binary); 149 | infile.seekg(0); 150 | for(int i=0; i(this),sizeof(*this)); 153 | if(i==(n-1)) 154 | continue; 155 | tmpfile.write(reinterpret_cast(this), sizeof(*this)); 156 | } 157 | infile.close(); 158 | tmpfile.close(); 159 | remove("record.bank"); 160 | rename("tmpfile.bank", "record.bank"); 161 | } 162 | void choice(){ 163 | Admin A; 164 | int choice; 165 | cout<<"***Acount Information System***"<Add record to file"; 170 | cout<<"\n\t2-->Show record from file"; 171 | cout<<"\n\t3-->Search Record from file"; 172 | cout<<"\n\t4-->Update Record"; 173 | cout<<"\n\t5-->Delete Record"; 174 | cout<<"\n\t6-->Quit"; 175 | cout<<"\nEnter your choice: "; 176 | cin>>choice; 177 | switch(choice) 178 | { 179 | case 1: 180 | A.write_rec(); 181 | break; 182 | case 2: 183 | A.read_rec(); 184 | break; 185 | case 3: 186 | A.search_rec(); 187 | break; 188 | case 4: 189 | A.edit_rec(); 190 | break; 191 | case 5: 192 | A.delete_rec(); 193 | break; 194 | case 6: 195 | exit(0); 196 | break; 197 | default: 198 | cout<<"\nEnter corret choice"; 199 | exit(0); 200 | } 201 | } 202 | system("pause"); 203 | } 204 | -------------------------------------------------------------------------------- /OOP PROJECT/real/New folder/customer_end.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include //for system cls and sleep and goto back: functions. 7 | #include // for get function 8 | 9 | using namespace std; 10 | 11 | class Customer{ // Main class 12 | private: 13 | string account_number; 14 | string firstName; 15 | string lastName; 16 | string date_of_opening; 17 | string address; 18 | string statius; 19 | float total_Balance; 20 | double CNIC; 21 | public: 22 | // Admin(){ 23 | void read_data(); 24 | void show_data(); 25 | void write_rec(); 26 | void read_rec(); 27 | void search_rec(); 28 | void edit_rec(); 29 | void delete_rec(); 30 | void choice(); 31 | // } 32 | }; 33 | void Customer::read_data() 34 | { 35 | cout<<"\nEnetr Date: "; 36 | cin>>date_of_opening; 37 | cout<<"Enter Account Number: "; 38 | cin>>account_number; 39 | cout<<"Enter First Name: "; 40 | cin>>firstName; 41 | cout<<"Enter Last Name: "; 42 | cin>>lastName; 43 | cout<<"Enter CNIC: "; 44 | cin>>CNIC; 45 | cout<<"Enter Address: "; 46 | cin>>address; 47 | cout<<"Enter your statius: "; 48 | cin>>statius; 49 | cout<<"Enter Balance: "; 50 | cin>>total_Balance; 51 | cout<(this), sizeof(*this)); 71 | outfile.close(); 72 | } 73 | void Customer::read_rec() 74 | { 75 | ifstream infile; 76 | infile.open("record.bank", ios::binary); 77 | if(!infile) 78 | { 79 | cout<<"Error in Opening! File Not Found!!"<(this), sizeof(*this))>0) 86 | { 87 | show_data(); 88 | } 89 | } 90 | infile.close(); 91 | } 92 | void Customer::search_rec() 93 | { 94 | int n; 95 | ifstream infile; 96 | infile.open("record.bank", ios::binary); 97 | if(!infile) 98 | { 99 | cout<<"\nError in opening! File Not Found!!"<>n; 107 | infile.seekg((n-1)*sizeof(*this)); 108 | infile.read(reinterpret_cast(this), sizeof(*this)); 109 | show_data(); 110 | } 111 | void Customer::edit_rec() 112 | { 113 | int n; 114 | fstream iofile; 115 | iofile.open("record.bank", ios::in|ios::binary); 116 | if(!iofile) 117 | { 118 | cout<<"\nError in opening! File Not Found!!"<>n; 126 | iofile.seekg((n-1)*sizeof(*this)); 127 | iofile.read(reinterpret_cast(this), sizeof(*this)); 128 | cout<<"Record "<(this), sizeof(*this)); 136 | } 137 | void Customer::delete_rec() 138 | { 139 | int n; 140 | ifstream infile; 141 | infile.open("record.bank", ios::binary); 142 | if(!infile) 143 | { 144 | cout<<"\nError in opening! File Not Found!!"<>n; 152 | fstream tmpfile; 153 | tmpfile.open("tmpfile.bank", ios::out|ios::binary); 154 | infile.seekg(0); 155 | for(int i=0; i(this),sizeof(*this)); 158 | if(i==(n-1)) 159 | continue; 160 | tmpfile.write(reinterpret_cast(this), sizeof(*this)); 161 | } 162 | infile.close(); 163 | tmpfile.close(); 164 | remove("record.bank"); 165 | rename("tmpfile.bank", "record.bank"); 166 | } 167 | void choice(){ 168 | Customer A; 169 | int choice; 170 | cout<<"***Acount Information System***"<Add record to file"; 175 | cout<<"\n\t2-->Show record from file"; 176 | cout<<"\n\t3-->Search Record from file"; 177 | cout<<"\n\t4-->Update Record"; 178 | cout<<"\n\t5-->Delete Record"; 179 | cout<<"\n\t6-->Quit"; 180 | cout<<"\nEnter your choice: "; 181 | cin>>choice; 182 | switch(choice) 183 | { 184 | case 1: 185 | A.write_rec(); 186 | break; 187 | case 2: 188 | A.read_rec(); 189 | break; 190 | case 3: 191 | A.search_rec(); 192 | break; 193 | case 4: 194 | A.edit_rec(); 195 | break; 196 | case 5: 197 | A.delete_rec(); 198 | break; 199 | case 6: 200 | exit(0); 201 | break; 202 | default: 203 | cout<<"\nEnter corret choice"; 204 | exit(0); 205 | } 206 | } 207 | system("pause"); 208 | } 209 | -------------------------------------------------------------------------------- /OOP PROJECT/Bank_Management_system/customer_end.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include //for system cls and sleep and goto back: functions. 7 | #include // for get function 8 | 9 | using namespace std; 10 | 11 | class Customer{ // Main class 12 | private: 13 | string account_number; 14 | string firstName; 15 | string lastName; 16 | string date_of_opening; 17 | string address; 18 | string statius; 19 | float total_Balance; 20 | double CNIC; 21 | public: 22 | // Admin(){ 23 | void read_data(); 24 | void show_data(); 25 | void write_rec(); 26 | void read_rec(); 27 | void search_rec(); 28 | void edit_rec(); 29 | void delete_rec(); 30 | void choice(); 31 | // } 32 | }; 33 | void Customer::read_data() 34 | { 35 | cout<<"\nEnetr Date: "; 36 | cin>>date_of_opening; 37 | cout<<"Enter Account Number: "; 38 | cin>>account_number; 39 | cout<<"Enter First Name: "; 40 | cin>>firstName; 41 | cout<<"Enter Last Name: "; 42 | cin>>lastName; 43 | cout<<"Enter CNIC: "; 44 | cin>>CNIC; 45 | cout<<"Enter Address: "; 46 | cin>>address; 47 | cout<<"Enter your statius: "; 48 | cin>>statius; 49 | cout<<"Enter Balance: "; 50 | cin>>total_Balance; 51 | cout<(this), sizeof(*this)); 71 | outfile.close(); 72 | } 73 | void Customer::read_rec() 74 | { 75 | ifstream infile; 76 | infile.open("record.bank", ios::binary); 77 | if(!infile) 78 | { 79 | cout<<"Error in Opening! File Not Found!!"<(this), sizeof(*this))>0) 86 | { 87 | show_data(); 88 | } 89 | } 90 | infile.close(); 91 | } 92 | void Customer::search_rec() 93 | { 94 | int n; 95 | ifstream infile; 96 | infile.open("record.bank", ios::binary); 97 | if(!infile) 98 | { 99 | cout<<"\nError in opening! File Not Found!!"<>n; 107 | infile.seekg((n-1)*sizeof(*this)); 108 | infile.read(reinterpret_cast(this), sizeof(*this)); 109 | show_data(); 110 | } 111 | void Customer::edit_rec() 112 | { 113 | int n; 114 | fstream iofile; 115 | iofile.open("record.bank", ios::in|ios::binary); 116 | if(!iofile) 117 | { 118 | cout<<"\nError in opening! File Not Found!!"<>n; 126 | iofile.seekg((n-1)*sizeof(*this)); 127 | iofile.read(reinterpret_cast(this), sizeof(*this)); 128 | cout<<"Record "<(this), sizeof(*this)); 136 | } 137 | void Customer::delete_rec() 138 | { 139 | int n; 140 | ifstream infile; 141 | infile.open("record.bank", ios::binary); 142 | if(!infile) 143 | { 144 | cout<<"\nError in opening! File Not Found!!"<>n; 152 | fstream tmpfile; 153 | tmpfile.open("tmpfile.bank", ios::out|ios::binary); 154 | infile.seekg(0); 155 | for(int i=0; i(this),sizeof(*this)); 158 | if(i==(n-1)) 159 | continue; 160 | tmpfile.write(reinterpret_cast(this), sizeof(*this)); 161 | } 162 | infile.close(); 163 | tmpfile.close(); 164 | remove("record.bank"); 165 | rename("tmpfile.bank", "record.bank"); 166 | } 167 | void choice(){ 168 | Customer A; 169 | int choice; 170 | cout<<"***Acount Information System***"<Add record to file"; 175 | cout<<"\n\t2-->Show record from file"; 176 | cout<<"\n\t3-->Search Record from file"; 177 | cout<<"\n\t4-->Update Record"; 178 | cout<<"\n\t5-->Delete Record"; 179 | cout<<"\n\t6-->Quit"; 180 | cout<<"\nEnter your choice: "; 181 | cin>>choice; 182 | switch(choice) 183 | { 184 | case 1: 185 | A.write_rec(); 186 | break; 187 | case 2: 188 | A.read_rec(); 189 | break; 190 | case 3: 191 | A.search_rec(); 192 | break; 193 | case 4: 194 | A.edit_rec(); 195 | break; 196 | case 5: 197 | A.delete_rec(); 198 | break; 199 | case 6: 200 | exit(0); 201 | break; 202 | default: 203 | cout<<"\nEnter corret choice"; 204 | exit(0); 205 | } 206 | } 207 | system("pause"); 208 | } 209 | -------------------------------------------------------------------------------- /OOP PROJECT/PROJECT/banking record system.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include //for system cls and sleep and goto back: functions. 6 | #include 7 | using namespace std; 8 | class Admin{ 9 | private: 10 | string account_number; 11 | string firstName; 12 | string lastName; 13 | string date_of_opening; 14 | string address; 15 | string statius; 16 | float total_Balance; 17 | double CNIC; 18 | public: 19 | // Admin(){ 20 | void read_data(); 21 | void show_data(); 22 | void write_rec(); 23 | void read_rec(); 24 | void search_rec(); 25 | void edit_rec(); 26 | void delete_rec(); 27 | int maniu(); 28 | // } 29 | }; 30 | void Admin::read_data() 31 | { 32 | system("CLS"); 33 | cout<<"\nEnetr Date: "; 34 | cin>>date_of_opening; 35 | cout<<"Enter Account Number: "; 36 | cin>>account_number; 37 | cout<<"Enter First Name: "; 38 | cin>>firstName; 39 | cout<<"Enter Last Name: "; 40 | cin>>lastName; 41 | cout<<"Enter CNIC: "; 42 | cin>>CNIC; 43 | cout<<"Enter Address: "; 44 | cin>>address; 45 | cout<<"Enter your statius: "; 46 | cin>>statius; 47 | cout<<"Enter Balance: "; 48 | cin>>total_Balance; 49 | cout<(this), sizeof(*this)); 71 | outfile.close(); 72 | } 73 | void Admin::read_rec() 74 | { 75 | system("CLS"); 76 | ifstream infile; 77 | infile.open("record.bank", ios::binary); 78 | if(!infile) 79 | { 80 | cout<<"Error in Opening! File Not Found!!"<(this), sizeof(*this))>0) 87 | { 88 | show_data(); 89 | } 90 | } 91 | infile.close(); 92 | } 93 | void Admin::search_rec() 94 | { 95 | system("CLS"); 96 | int n; 97 | ifstream infile; 98 | infile.open("record.bank", ios::binary); 99 | if(!infile) 100 | { 101 | cout<<"\nError in opening! File Not Found!!"<>n; 109 | infile.seekg((n-1)*sizeof(*this)); 110 | infile.read(reinterpret_cast(this), sizeof(*this)); 111 | show_data(); 112 | } 113 | void Admin::edit_rec() 114 | { 115 | system("CLS"); 116 | int n; 117 | fstream iofile; 118 | iofile.open("record.bank", ios::in|ios::binary); 119 | if(!iofile) 120 | { 121 | cout<<"\nError in opening! File Not Found!!"<>n; 129 | iofile.seekg((n-1)*sizeof(*this)); 130 | iofile.read(reinterpret_cast(this), sizeof(*this)); 131 | cout<<"Record "<(this), sizeof(*this)); 139 | } 140 | void Admin::delete_rec() 141 | { 142 | system("CLS"); 143 | int n; 144 | ifstream infile; 145 | infile.open("record.bank", ios::binary); 146 | if(!infile) 147 | { 148 | cout<<"\nError in opening! File Not Found!!"<>n; 156 | fstream tmpfile; 157 | tmpfile.open("tmpfile.bank", ios::out|ios::binary); 158 | infile.seekg(0); 159 | for(int i=0; i(this),sizeof(*this)); 162 | if(i==(n-1)) 163 | continue; 164 | tmpfile.write(reinterpret_cast(this), sizeof(*this)); 165 | } 166 | infile.close(); 167 | tmpfile.close(); 168 | remove("record.bank"); 169 | rename("tmpfile.bank", "record.bank"); 170 | } 171 | int maniu(){ 172 | Admin A; 173 | int choice; 174 | cout<<"***Acount Information System***"<Add record to file"; 180 | cout<<"\n\t2-->Show record from file"; 181 | cout<<"\n\t3-->Search Record from file"; 182 | cout<<"\n\t4-->Update Record"; 183 | cout<<"\n\t5-->Delete Record"; 184 | cout<<"\n\t6-->Quit"; 185 | cout<<"\nEnter your choice: "; 186 | cin>>choice; 187 | system("CLS"); 188 | switch(choice) 189 | { 190 | case 1: 191 | A.write_rec(); 192 | break; 193 | case 2: 194 | A.read_rec(); 195 | break; 196 | case 3: 197 | A.search_rec(); 198 | break; 199 | case 4: 200 | A.edit_rec(); 201 | break; 202 | case 5: 203 | A.delete_rec(); 204 | break; 205 | case 6: 206 | exit(0); 207 | break; 208 | default: 209 | cout<<"\nEnter corret choice"; 210 | exit(0); 211 | } 212 | } 213 | system("pause"); 214 | return 0; 215 | } 216 | -------------------------------------------------------------------------------- /OOP PROJECT/RBMS - Copy/loan.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | //class loan{ 7 | // public: 8 | // void getloan(); 9 | 10 | //National record 11 | struct National_record{ 12 | char Nationality[20]; 13 | char Gender[20]; 14 | int Cnic; 15 | char Religion[20]; 16 | char name[20]; 17 | void waitForEnter(){ 18 | cout << "\n\nPress enter to go back: "; 19 | cin.get(); 20 | } 21 | void getloan(); 22 | //Personal information 23 | struct Personal_information{ 24 | char email[20]; 25 | char address[20]; 26 | char Education[20]; 27 | int age; 28 | int phone_number; 29 | 30 | }; 31 | 32 | //Professional information 33 | struct Professional_information{ 34 | float salary; 35 | int ID; 36 | char company_name[20]; 37 | int working_experience; 38 | int working_hours; 39 | }; 40 | 41 | //Bank information 42 | struct Bank_information{ 43 | int Acc_number; 44 | char ac_email[20]; 45 | char Bank_name[20]; 46 | int balance; 47 | int credit_card; 48 | int lamount; 49 | string Reason; 50 | string till; 51 | string when; 52 | }; 53 | 54 | struct Personal_information Pers; 55 | struct Professional_information Prof; 56 | struct Bank_information Acinfo; 57 | }; 58 | 59 | //}; 60 | //================================================================= 61 | 62 | void getloan(){ 63 | National_record nat[2]; 64 | int i; 65 | for(i=0;i<1;i++){ 66 | system("cls"); 67 | //National record of client 68 | cout << "\n\t\t\t\t\t-------------------------------" << endl; 69 | cout << "\t\t\t\t\t>> APPLYING FORM <<" << endl; 70 | cout << "\t\t\t\t\t-------------------------------" << endl; 71 | cout<>nat[i].name,19; 74 | cout<>nat[i].Cnic; 77 | cout<>nat[i].Gender,19; 80 | cout<>nat[i].Nationality,19; 83 | cout<>nat[i].Religion,19; 86 | cout<>nat[i].Pers.address,19; 91 | cout<>nat[i].Pers.age; 94 | cout<>nat[i].Pers.Education,19; 97 | cout<>nat[i].Pers.email,19; 100 | cout<>nat[i].Pers.phone_number; 103 | cout<>nat[i].Prof.ID; 108 | cout<>nat[i].Prof.working_experience; 111 | cout<>nat[i].Prof.company_name,19; 114 | cout<>nat[i].Prof.working_hours; 117 | cout<>nat[i].Prof.salary; 120 | cout<>nat[i].Acinfo.Acc_number; 125 | cout<>nat[i].Acinfo.Bank_name,19; 128 | cout<>nat[i].Acinfo.balance; 131 | cout<>nat[i].Acinfo.ac_email,19; 134 | cout<>nat[i].Acinfo.credit_card; 137 | cout<>nat[i].Acinfo.Reason; 140 | cout<>nat[i].Acinfo.lamount; 143 | cout<>nat[i].Acinfo.till; 146 | cout<>nat[i].Acinfo.when; 149 | cout< 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | 9 | class emp{ 10 | public: 11 | string name,id,address; 12 | 13 | int salary,contact; 14 | 15 | }; 16 | 17 | int total=0; 18 | 19 | emp e[100]; 20 | 21 | void empdata(){ 22 | 23 | int user=0; 24 | 25 | cout<<"How many employees data do you want to enter??"<>user; 28 | 29 | for(int i=total;i>e[i].name; 36 | 37 | cout<<"Enter id: "; 38 | 39 | cin>>e[i].id; 40 | 41 | cout<<"Enter address: "; 42 | 43 | cin>>e[i].address; 44 | 45 | cout<<"Enter contact: "; 46 | 47 | cin>>e[i].contact; 48 | 49 | cout<<"Enter salary: "; 50 | 51 | cin>>e[i].salary; 52 | 53 | } 54 | 55 | total=total+user; 56 | 57 | } 58 | 59 | void show(){ 60 | 61 | if(total!=0){ 62 | 63 | for(int i=0;i>id; 98 | 99 | for(int i=0;i>id; 144 | 145 | for(int i=0;i>e[i].name; 166 | 167 | cout<<"Enter id: "; 168 | 169 | cin>>e[i].id; 170 | 171 | cout<<"Enter address: "; 172 | 173 | cin>>e[i].address; 174 | 175 | cout<<"Enter contact: "; 176 | 177 | cin>>e[i].contact; 178 | 179 | cout<<"Enter salary: "; 180 | 181 | cin>>e[i].salary; 182 | 183 | break; 184 | 185 | } 186 | 187 | if(i==total-1){ 188 | 189 | cout<<"No such record found"<>press; 214 | 215 | if(press==1){ 216 | 217 | string id; 218 | 219 | cout<<"Enter id of employee which you want to delete"<>id; 222 | 223 | for(int i=0;i>username; 288 | 289 | cout<<"\t\tEnter new password: "; 290 | 291 | cin>>password; 292 | 293 | cout<<"\t\tYour new id is creating please wait"; 294 | 295 | for(int i=0;i<6;i++) 296 | 297 | { 298 | 299 | cout<<"."; 300 | 301 | Sleep(500); 302 | 303 | } 304 | 305 | cout<<"\n\t\tYour id created successfully"; 306 | 307 | Sleep(2000); 308 | 309 | start: 310 | 311 | system("CLS"); 312 | 313 | string usrn,pswd; 314 | 315 | 316 | cout<<"\n\n\n\t\t LOGIN"<>usrn; 321 | 322 | cout<<"\t\tEnter password: "; 323 | 324 | cin>>pswd; 325 | 326 | if(usrn==username&&pswd==password) 327 | 328 | { 329 | 330 | system("CLS"); 331 | 332 | char ch; 333 | 334 | while(1){ 335 | 336 | cout<<"\n\nPress 1 to enter data"< 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | 10 | class Employees{ 11 | public: 12 | string name,id,address; 13 | 14 | int salary,contact; 15 | 16 | }; 17 | 18 | int total=0; 19 | 20 | Employees e[100]; 21 | 22 | void empdata(){ 23 | 24 | int user=0; 25 | 26 | cout<<"How many employees data do you want to enter??"<>user; 29 | 30 | for(int i=total;i>e[i].name; 37 | 38 | cout<<"Enter id: "; 39 | 40 | cin>>e[i].id; 41 | 42 | cout<<"Enter address: "; 43 | 44 | cin>>e[i].address; 45 | 46 | cout<<"Enter contact: "; 47 | 48 | cin>>e[i].contact; 49 | 50 | cout<<"Enter salary: "; 51 | 52 | cin>>e[i].salary; 53 | 54 | } 55 | 56 | total=total+user; 57 | 58 | } 59 | 60 | void show(){ 61 | 62 | if(total!=0){ 63 | 64 | for(int i=0;i>id; 99 | 100 | for(int i=0;i>id; 145 | 146 | for(int i=0;i>e[i].name; 167 | 168 | cout<<"Enter id: "; 169 | 170 | cin>>e[i].id; 171 | 172 | cout<<"Enter address: "; 173 | 174 | cin>>e[i].address; 175 | 176 | cout<<"Enter contact: "; 177 | 178 | cin>>e[i].contact; 179 | 180 | cout<<"Enter salary: "; 181 | 182 | cin>>e[i].salary; 183 | 184 | break; 185 | 186 | } 187 | 188 | if(i==total-1){ 189 | 190 | cout<<"No such record found"<>press; 215 | 216 | if(press==1){ 217 | 218 | string id; 219 | 220 | cout<<"Enter id of employee which you want to delete"<>id; 223 | 224 | for(int i=0;i>username; 289 | 290 | cout<<"\t\tEnter new password: "; 291 | 292 | cin>>password; 293 | 294 | cout<<"\t\tYour new id is creating please wait"; 295 | 296 | for(int i=0;i<6;i++) 297 | 298 | { 299 | 300 | cout<<"."; 301 | 302 | Sleep(500); 303 | 304 | } 305 | 306 | cout<<"\n\t\tYour id created successfully"; 307 | 308 | Sleep(2000); 309 | 310 | start: 311 | 312 | system("CLS"); 313 | 314 | string usrn,pswd; 315 | 316 | 317 | cout<<"\n\n\n\t\t LOGIN"<>usrn; 322 | 323 | cout<<"\t\tEnter password: "; 324 | 325 | cin>>pswd; 326 | 327 | if(usrn==username&&pswd==password) 328 | 329 | { 330 | 331 | system("CLS"); 332 | 333 | char ch; 334 | 335 | while(1){ 336 | 337 | cout<<"\n\nPress 1 to enter data"< 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | 9 | class emp{ 10 | public: 11 | string name,id,address; 12 | 13 | int salary,contact; 14 | 15 | }; 16 | 17 | int total=0; 18 | 19 | emp e[100]; 20 | 21 | void empdata(){ 22 | 23 | int user=0; 24 | 25 | cout<<"How many employees data do you want to enter??"<>user; 28 | 29 | for(int i=total;i>e[i].name; 36 | 37 | cout<<"Enter id: "; 38 | 39 | cin>>e[i].id; 40 | 41 | cout<<"Enter address: "; 42 | 43 | cin>>e[i].address; 44 | 45 | cout<<"Enter contact: "; 46 | 47 | cin>>e[i].contact; 48 | 49 | cout<<"Enter salary: "; 50 | 51 | cin>>e[i].salary; 52 | 53 | } 54 | 55 | total=total+user; 56 | 57 | } 58 | 59 | void show(){ 60 | 61 | if(total!=0){ 62 | 63 | for(int i=0;i>id; 98 | 99 | for(int i=0;i>id; 144 | 145 | for(int i=0;i>e[i].name; 166 | 167 | cout<<"Enter id: "; 168 | 169 | cin>>e[i].id; 170 | 171 | cout<<"Enter address: "; 172 | 173 | cin>>e[i].address; 174 | 175 | cout<<"Enter contact: "; 176 | 177 | cin>>e[i].contact; 178 | 179 | cout<<"Enter salary: "; 180 | 181 | cin>>e[i].salary; 182 | 183 | break; 184 | 185 | } 186 | 187 | if(i==total-1){ 188 | 189 | cout<<"No such record found"<>press; 214 | 215 | if(press==1){ 216 | 217 | string id; 218 | 219 | cout<<"Enter id of employee which you want to delete"<>id; 222 | 223 | for(int i=0;i>username; 288 | 289 | cout<<"\t\tEnter new password: "; 290 | 291 | cin>>password; 292 | 293 | cout<<"\t\tYour new id is creating please wait"; 294 | 295 | for(int i=0;i<6;i++) 296 | 297 | { 298 | 299 | cout<<"."; 300 | 301 | Sleep(500); 302 | 303 | } 304 | 305 | cout<<"\n\t\tYour id created successfully"; 306 | 307 | Sleep(2000); 308 | 309 | start: 310 | 311 | system("CLS"); 312 | 313 | string usrn,pswd; 314 | 315 | cout<<"\n\n\t\tEmployee Management System"<>usrn; 322 | 323 | cout<<"\t\tEnter password: "; 324 | 325 | cin>>pswd; 326 | 327 | if(usrn==username&&pswd==password) 328 | 329 | { 330 | 331 | system("CLS"); 332 | 333 | char ch; 334 | 335 | while(1){ 336 | 337 | cout<<"\n\nPress 1 to enter data"< 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | using namespace std; 10 | 11 | 12 | class emp{ 13 | public: 14 | string name,id,address; 15 | 16 | int salary,contact; 17 | 18 | }; 19 | 20 | int total=0; 21 | 22 | emp e[100]; 23 | 24 | void empdata(){ 25 | 26 | int user=0; 27 | 28 | cout<<"How many employees data do you want to enter??"<>user; 31 | 32 | for(int i=total;i>e[i].name; 39 | 40 | cout<<"Enter id: "; 41 | 42 | cin>>e[i].id; 43 | 44 | cout<<"Enter address: "; 45 | 46 | cin>>e[i].address; 47 | 48 | cout<<"Enter contact: "; 49 | 50 | cin>>e[i].contact; 51 | 52 | cout<<"Enter salary: "; 53 | 54 | cin>>e[i].salary; 55 | 56 | } 57 | 58 | total=total+user; 59 | 60 | } 61 | 62 | void show(){ 63 | 64 | if(total!=0){ 65 | 66 | for(int i=0;i>id; 101 | 102 | for(int i=0;i>id; 147 | 148 | for(int i=0;i>e[i].name; 169 | 170 | cout<<"Enter id: "; 171 | 172 | cin>>e[i].id; 173 | 174 | cout<<"Enter address: "; 175 | 176 | cin>>e[i].address; 177 | 178 | cout<<"Enter contact: "; 179 | 180 | cin>>e[i].contact; 181 | 182 | cout<<"Enter salary: "; 183 | 184 | cin>>e[i].salary; 185 | 186 | break; 187 | 188 | } 189 | 190 | if(i==total-1){ 191 | 192 | cout<<"No such record found"<>press; 217 | 218 | if(press==1){ 219 | 220 | string id; 221 | 222 | cout<<"Enter id of employee which you want to delete"<>id; 225 | 226 | for(int i=0;i>username; 291 | 292 | cout<<"\t\tEnter new password: "; 293 | 294 | cin>>password; 295 | 296 | cout<<"\t\tYour new id is creating please wait"; 297 | 298 | for(int i=0;i<6;i++) 299 | 300 | { 301 | 302 | cout<<"."; 303 | 304 | Sleep(500); 305 | 306 | } 307 | 308 | cout<<"\n\t\tYour id created successfully"; 309 | 310 | Sleep(2000); 311 | 312 | start: 313 | 314 | system("CLS"); 315 | 316 | string usrn,pswd; 317 | 318 | cout<<"\n\n\t\tEmployee Management System"<>usrn; 325 | 326 | cout<<"\t\tEnter password: "; 327 | 328 | cin>>pswd; 329 | 330 | if(usrn==username&&pswd==password) 331 | 332 | { 333 | 334 | system("CLS"); 335 | 336 | char ch; 337 | 338 | while(1){ 339 | 340 | cout<<"\n\nPress 1 to enter data"< 2 | #include 3 | #include //for system cls and sleep and goto back: functions. 4 | #include // for get function 5 | using namespace std; 6 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 7 | 8 | class Bank{ // Main class 9 | private: 10 | int total; 11 | string id; 12 | struct person{ // Inheritance Structure to store basic data. 13 | string name,ID,address; 14 | int contact; 15 | static int cash; //static data member 16 | }person[100]; // Array to store data. 17 | public: 18 | Bank(){ // Constructor 19 | total=0; 20 | void login(); 21 | void choice(); 22 | void Createaccount(); 23 | void show(); 24 | void update(); 25 | void search(); 26 | void transactions(); 27 | void del(); 28 | } 29 | void login(){ 30 | 31 | } 32 | 33 | void choice(){ 34 | int ch; 35 | while(1){ 36 | cout<<"\t*********************PRESS FOLLOWIING OF YOUR CHOICE..!!********************"< Create new account\t\t\t\t|*|"< View customers list\t\t\t\t|*|"< Update information of existing account\t|*|"< Check the details of an existing account\t|*|"< For transactions\t\t\t\t|*|"< Remove existing account\t\t\t|*|"< Exit\t\t\t\t\t|*|"<>person[total].name; 105 | cout<<"ID:"; 106 | cin>>person[total].ID; 107 | cout<<"Address:"; 108 | cin>>person[total].address; 109 | cout<<"Contact: "; 110 | cin>>person[total].contact; 111 | cout<<"Total Cash: "; 112 | cin>>person[total].cash; 113 | total++; 114 | } 115 | 116 | void show(){ // View customers list 117 | for(int i=0;i>id; 130 | for(int i=0;i>person[i].name; 142 | cout<<"ID: "; 143 | cin>>person[i].ID; 144 | cout<<"Address: "; 145 | cin>>person[i].address; 146 | cout<<"Contact: "; 147 | cin>>person[i].contact; 148 | cout<<"Total Cash: "; 149 | cin>>person[i].cash; 150 | break; 151 | } 152 | if(i==total-1){ //It is for any worng input those id which doesn't esixted. 153 | cout<<"No such record found"<>id; 161 | for(int i=0;i>id; 181 | for(int i=0;i>ch; 190 | ch=getch(); 191 | switch(ch){ 192 | case '1': 193 | cout<<"How much cash you want to deposit??"<>cash; 195 | person[i].cash+=cash; 196 | cout<<"Your new cash is "<>cash; // | 202 | if(cash>person[i].cash){ // | 203 | cout<<"Your existing cash is just "<>ch; 227 | ch=getch(); 228 | switch(ch){ 229 | case '1': 230 | cout<<"Enter id of person those data you want to remove"<>id; 232 | for(int i=0;i 2 | #include 3 | #include //for system cls and sleep and goto back: functions. 4 | #include // for get function 5 | using namespace std; 6 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 7 | 8 | class Bank{ // Main class 9 | private: 10 | int total; 11 | string id; 12 | struct person{ // Inheritance Structure to store basic data. 13 | string name,ID,address; 14 | int contact; 15 | static int cash; //static data member 16 | }person[100]; // Array to store data. 17 | public: 18 | Bank(){ // Constructor 19 | total=0; 20 | void login(); 21 | void choice(); 22 | void Createaccount(); 23 | void show(); 24 | void update(); 25 | void search(); 26 | void transactions(); 27 | void del(); 28 | } 29 | void login(){ 30 | 31 | } 32 | 33 | void choice(){ 34 | int ch; 35 | while(1){ 36 | cout<<"\t*********************PRESS FOLLOWIING OF YOUR CHOICE..!!********************"< Create new account\t\t\t\t|*|"< View customers list\t\t\t\t|*|"< Update information of existing account\t|*|"< Check the details of an existing account\t|*|"< For transactions\t\t\t\t|*|"< Remove existing account\t\t\t|*|"< Exit\t\t\t\t\t|*|"<>person[total].name; 105 | cout<<"ID:"; 106 | cin>>person[total].ID; 107 | cout<<"Address:"; 108 | cin>>person[total].address; 109 | cout<<"Contact: "; 110 | cin>>person[total].contact; 111 | cout<<"Total Cash: "; 112 | cin>>person[total].cash; 113 | total++; 114 | } 115 | 116 | void show(){ // View customers list 117 | for(int i=0;i>id; 130 | for(int i=0;i>person[i].name; 142 | cout<<"ID: "; 143 | cin>>person[i].ID; 144 | cout<<"Address: "; 145 | cin>>person[i].address; 146 | cout<<"Contact: "; 147 | cin>>person[i].contact; 148 | cout<<"Total Cash: "; 149 | cin>>person[i].cash; 150 | break; 151 | } 152 | if(i==total-1){ //It is for any worng input those id which doesn't esixted. 153 | cout<<"No such record found"<>id; 161 | for(int i=0;i>id; 181 | for(int i=0;i>ch; 190 | ch=getch(); 191 | switch(ch){ 192 | case '1': 193 | cout<<"How much cash you want to deposit??"<>cash; 195 | person[i].cash+=cash; 196 | cout<<"Your new cash is "<>cash; // | 202 | if(cash>person[i].cash){ // | 203 | cout<<"Your existing cash is just "<>ch; 227 | ch=getch(); 228 | switch(ch){ 229 | case '1': 230 | cout<<"Enter id of person those data you want to remove"<>id; 232 | for(int i=0;i 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | 8 | class account{ 9 | int acno; 10 | char name[50]; 11 | int deposit; 12 | char type; 13 | public: 14 | void create_account(); //function to get data from user 15 | void show_account() const; //function to show data on screen 16 | void modify(); //function to add new data 17 | void dep(int); //function to accept amount and add to balance amount 18 | void draw(int); //function to accept amount and subtract from balance amount 19 | void report() const; //function to show data in tabular format 20 | int retacno() const; //function to return account number 21 | int retdeposit() const; //function to return balance amount 22 | char rettype() const; //function to return type of account 23 | void MENU() const; 24 | }; //class ends here 25 | 26 | void account::create_account(){ 27 | cout<<"\nEnter The account No. :"; 28 | cin>>acno; 29 | cout<<"\n\nEnter The Name of The account Holder : "; 30 | cin.ignore(); 31 | cin.getline(name,50); 32 | cout<<"\nEnter Type of The account (C/S) : "; 33 | cin>>type; 34 | type=toupper(type); 35 | cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) : "; 36 | cin>>deposit; 37 | cout<<"\n\n\nAccount Created.."; 38 | } 39 | 40 | void account::show_account() const{ 41 | cout<<"\nAccount No. : "<>type; 56 | type=toupper(type); 57 | cout<<"\nModify Balance amount : "; 58 | cin>>deposit; 59 | } 60 | 61 | 62 | void account::dep(int x){ 63 | deposit+=x; 64 | } 65 | 66 | void account::draw(int x){ 67 | deposit-=x; 68 | } 69 | 70 | void account::report() const{ 71 | cout<>ch; 112 | system("cls"); 113 | switch(ch){ 114 | case '1': 115 | write_account(); 116 | break; 117 | case '2': 118 | cout<<"\n\n\tEnter The account No. : "; cin>>num; 119 | deposit_withdraw(num, 1); 120 | break; 121 | case '3': 122 | cout<<"\n\n\tEnter The account No. : "; cin>>num; 123 | deposit_withdraw(num, 2); 124 | break; 125 | case '4': 126 | cout<<"\n\n\tEnter The account No. : "; cin>>num; 127 | display_sp(num); 128 | break; 129 | case '5': 130 | display_all(); 131 | break; 132 | case '6': 133 | cout<<"\n\n\tEnter The account No. : "; cin>>num; 134 | delete_account(num); 135 | break; 136 | case '7': 137 | cout<<"\n\n\tEnter The account No. : "; cin>>num; 138 | modify_account(num); 139 | break; 140 | case '8': 141 | cout<<"\n\n\tThanks for using bank managemnt system"; 142 | break; 143 | default :cout<<"\a"; 144 | } 145 | cin.ignore(); 146 | cin.get(); 147 | }while(ch!='8'); 148 | } 149 | 150 | 151 | void write_account(){ 152 | account ac; 153 | ofstream outFile; 154 | outFile.open("account.dat",ios::binary|ios::app); 155 | ac.create_account(); 156 | outFile.write(reinterpret_cast (&ac), sizeof(account)); 157 | outFile.close(); 158 | } 159 | 160 | void display_sp(int n){ 161 | account ac; 162 | bool flag=false; 163 | ifstream inFile; 164 | inFile.open("account.dat",ios::binary); 165 | if(!inFile){ 166 | cout<<"File could not be open !! Press any Key..."; 167 | } 168 | cout<<"\nBALANCE DETAILS\n"; 169 | 170 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))){ 171 | if(ac.retacno()==n){ 172 | ac.show_account(); 173 | flag=true; 174 | } 175 | } 176 | inFile.close(); 177 | if(flag==false) 178 | cout<<"\n\nAccount number does not exist"; 179 | } 180 | 181 | void modify_account(int n){ 182 | bool found=false; 183 | account ac; 184 | fstream File; 185 | File.open("account.dat",ios::binary|ios::in|ios::out); 186 | if(!File){ 187 | cout<<"File could not be open !! Press any Key..."; 188 | 189 | } 190 | while(!File.eof() && found==false){ 191 | File.read(reinterpret_cast (&ac), sizeof(account)); 192 | if(ac.retacno()==n){ 193 | ac.show_account(); 194 | cout<<"\n\nEnter The New Details of account"<(sizeof(account)); 197 | File.seekp(pos,ios::cur); 198 | File.write(reinterpret_cast (&ac), sizeof(account)); 199 | cout<<"\n\n\t Record Updated"; 200 | found=true; 201 | } 202 | } 203 | File.close(); 204 | if(found==false) 205 | cout<<"\n\n Record Not Found "; 206 | } 207 | 208 | 209 | void delete_account(int n){ 210 | account ac; 211 | ifstream inFile; 212 | ofstream outFile; 213 | inFile.open("account.dat",ios::binary); 214 | if(!inFile){ 215 | cout<<"File could not be open !! Press any Key..."; 216 | } 217 | outFile.open("Temp.dat",ios::binary); 218 | inFile.seekg(0,ios::beg); 219 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))){ 220 | if(ac.retacno()!=n){ 221 | outFile.write(reinterpret_cast (&ac), sizeof(account)); 222 | } 223 | } 224 | inFile.close(); 225 | outFile.close(); 226 | remove("account.dat"); 227 | rename("Temp.dat","account.dat"); 228 | cout<<"\n\n\tRecord Deleted .."; 229 | } 230 | 231 | void display_all(){ 232 | account ac; 233 | ifstream inFile; 234 | inFile.open("account.dat",ios::binary); 235 | if(!inFile){ 236 | cout<<"File could not be open !! Press any Key..."; 237 | return; 238 | } 239 | cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; 240 | cout<<"====================================================\n"; 241 | cout<<"Accunt No. NAME Type Balance\n"; 242 | cout<<"====================================================\n"; 243 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))){ 244 | ac.report(); 245 | } 246 | inFile.close(); 247 | } 248 | 249 | void deposit_withdraw(int n, int option){ 250 | int amt; 251 | bool found=false; 252 | account ac; 253 | fstream File; 254 | File.open("account.dat", ios::binary|ios::in|ios::out); 255 | if(!File){ 256 | cout<<"File could not be open !! Press any Key..."; 257 | return; 258 | } 259 | while(!File.eof() && found==false){ 260 | File.read(reinterpret_cast (&ac), sizeof(account)); 261 | if(ac.retacno()==n){ 262 | ac.show_account(); 263 | if(option==1){ 264 | cout<<"\n\n\tTO DEPOSITE AMOUNT "; 265 | cout<<"\n\nEnter The amount to be deposited"; 266 | cin>>amt; 267 | ac.dep(amt); 268 | } 269 | if(option==2){ 270 | cout<<"\n\n\tTO WITHDRAW AMOUNT "; 271 | cout<<"\n\nEnter The amount to be withdraw"; 272 | cin>>amt; 273 | int bal=ac.retdeposit()-amt; 274 | if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C')) 275 | cout<<"Insufficience balance"; 276 | else 277 | ac.draw(amt); 278 | } 279 | int pos=(-1)*static_cast(sizeof(ac)); 280 | File.seekp(pos,ios::cur); 281 | File.write(reinterpret_cast (&ac), sizeof(account)); 282 | cout<<"\n\n\t Record Updated"; 283 | found=true; 284 | } 285 | } 286 | File.close(); 287 | if(found==false) 288 | cout<<"\n\n Record Not Found "; 289 | } 290 | -------------------------------------------------------------------------------- /OOP PROJECT/Bank_Management_system/customer_end.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include //for system cls and sleep and goto back: functions. 4 | #include // for get function 5 | 6 | using namespace std; 7 | 8 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 9 | 10 | class Bank{ // Main class 11 | private: 12 | int total; 13 | string id; 14 | struct person{ // Inheritance Structure to store basic data. 15 | string name,ID,address; 16 | int contact,cash; 17 | }person[100]; // Array to store data. 18 | public: 19 | Bank(){ // Constructor 20 | total=0; 21 | void choice(); 22 | void Createaccount(); 23 | void show(); 24 | void update(); 25 | void search(); 26 | void transactions(); 27 | void del(); 28 | void login(); 29 | } 30 | 31 | void choice(){ 32 | int ch; 33 | while(1){ 34 | cout<<"PRESS FOLLOWIING OF YOUR CHOICE..!!"< Create new account"< View customers list"< Update information of existing account"< Check the details of an existing account"< For transactions"< Remove existing account"< Exit"<>person[total].name; 101 | cout<<"ID:"; 102 | cin>>person[total].ID; 103 | cout<<"Address:"; 104 | cin>>person[total].address; 105 | cout<<"Contact: "; 106 | cin>>person[total].contact; 107 | cout<<"Total Cash: "; 108 | cin>>person[total].cash; 109 | total++; 110 | } 111 | 112 | void show(){ // View customers list 113 | for(int i=0;i>id; 126 | for(int i=0;i>person[i].name; 138 | cout<<"ID: "; 139 | cin>>person[i].ID; 140 | cout<<"Address: "; 141 | cin>>person[i].address; 142 | cout<<"Contact: "; 143 | cin>>person[i].contact; 144 | cout<<"Total Cash: "; 145 | cin>>person[i].cash; 146 | break; 147 | } 148 | if(i==total-1){ //It is for any worng input those id which doesn't esixted. 149 | cout<<"No such record found"<>id; 157 | for(int i=0;i>id; 177 | for(int i=0;i>ch; 186 | ch=getch(); 187 | switch(ch){ 188 | case '1': 189 | cout<<"How much cash you want to deposit??"<>cash; 191 | person[i].cash+=cash; 192 | cout<<"Your new cash is "<>cash; // | 198 | if(cash>person[i].cash){ // | 199 | cout<<"Your existing cash is just "<>ch; 223 | ch=getch(); 224 | switch(ch){ 225 | case '1': 226 | cout<<"Enter id of person those data you want to remove"<>id; 228 | for(int i=0;i>username; 272 | cout<<"\t\tEnter new password: "; 273 | cin>>password; 274 | cout<<"\t\tYour new id is creating please wait"; 275 | for(int i=0;i<6;i++) 276 | { 277 | cout<<"."; 278 | Sleep(500); 279 | } 280 | cout<<"\n\t\tYour id created successfully"; 281 | Sleep(2000); 282 | start: 283 | system("CLS"); 284 | string usrn,pswd; 285 | cout<<"\n\n\t\tEmployee Management System"<>usrn; 289 | cout<<"\t\tEnter password: "; 290 | cin>>pswd; 291 | if(usrn==username&&pswd==password) 292 | { 293 | system("CLS"); 294 | char ch; 295 | } 296 | } 297 | 298 | -------------------------------------------------------------------------------- /OOP PROJECT/RBMS - Copy/ATM.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include //for system cls and sleep and goto back: functions. 7 | #include // for get function 8 | using namespace std; 9 | 10 | class Bank{ 11 | public: 12 | virtual void showData(void) = 0; //concept of abstract class and pure virtual function 13 | }; 14 | 15 | class atm:public Bank{ 16 | private: 17 | char username[30]; 18 | int password; 19 | int balance; 20 | 21 | public: 22 | char* usernames(void){ 23 | return username; 24 | } 25 | 26 | int passwords(void){ 27 | return password; 28 | } 29 | 30 | 31 | void getData(void){ // Function to get the data (getter) 32 | cin.ignore(numeric_limits::max(),'\n'); 33 | cout << "\nEnter username:"; 34 | cin.getline(username, 30); 35 | cout << "\nEnter 4-digit password:"; 36 | cin >> password; 37 | cin.ignore(numeric_limits::max(),'\n'); 38 | cout << "\nEnter initial balance:"; 39 | cin >> balance; 40 | cin.ignore(numeric_limits::max(),'\n'); 41 | } 42 | 43 | void showData(void){ // Function displaying the data (setter) 44 | cout << "Username:" << username< Admin\n2->User\n3->Exit\nChoose one : "; 68 | cin >> ch; 69 | 70 | switch (ch) { 71 | case 1: 72 | rerun: 73 | system("cls"); 74 | cout << "\nEnter details to login as Admin..!!\n"; 75 | cout << "\nEnter password:"; 76 | cin >> pass; 77 | if (pass == 1234) { 78 | admin: 79 | system("cls"); 80 | cout << "\nWelcome to Admin Menu..!"<Add User\n2.->Delete User\n3->View All User\n4->Exit\n"; 82 | cout << "\nSelect one : "; 83 | cin >> ch1; 84 | switch (ch1) { 85 | case 1: 86 | a.add_user(); 87 | goto admin; 88 | 89 | case 2: 90 | cout << "\nEnter the Username to be deleted : "<::max(),'\n'); 92 | cin.getline(uname, 30); 93 | a.delete_user(uname); 94 | goto admin; 95 | 96 | case 3: 97 | a.view_all_users(); 98 | sleep(4); 99 | goto admin; 100 | 101 | case 4: 102 | break; 103 | } 104 | } 105 | else { 106 | cout << "\nDetails are incorrect ! Please try again....."; 107 | cin.get(); 108 | goto rerun; 109 | } 110 | goto mainmenu; 111 | 112 | case 2: 113 | system("cls"); 114 | cout << "\n Enter details to login as User\n"; 115 | cin.ignore(numeric_limits::max(),'\n'); 116 | cout << "Enter username:"; 117 | cin.getline(uname, 30); 118 | cout << "\nEnter password:"; 119 | cin >> pass; 120 | found = a.search_specific_user(uname, pass); 121 | if (found) { 122 | user: 123 | system("cls"); 124 | cout << "\nWelcome "<< uname; 125 | cout << "\nWelcome to User Menu..!!"; 126 | cout << "\n1->Deposit\n2->Withdraw\n3->View Account\n4->Exit\nEnter your choice:"; 127 | cin >> ch2; 128 | switch (ch2) { 129 | case 1: 130 | a.update_user_as_deposit(uname); 131 | goto user; 132 | case 2: 133 | a.update_user_as_withdraw(uname); 134 | goto user; 135 | case 3: 136 | a.search_all_user_to_display(uname); 137 | sleep(4); 138 | goto user; 139 | case 4: 140 | cout << "Thank you"; 141 | break; 142 | } 143 | } 144 | else { 145 | cout << "\nNo account found with username "<> b; 229 | a.balance = a.balance + b; 230 | cout << "\nBalance is:"<< a.balance; 231 | temp.write((char*)&a, sizeof(a)); 232 | } 233 | else { 234 | temp.write((char*)&a, sizeof(a)); 235 | } 236 | file.read((char*)&a, sizeof(a)); 237 | } 238 | file.close(); 239 | temp.close(); 240 | remove("atm.txt"); 241 | rename("temp.txt", "atm.txt"); 242 | } 243 | 244 | void atm::update_user_as_withdraw(char* uname){ // Function to update user by 245 | atm a; // depositing withdrawing user givcen amount 246 | fstream file, temp; 247 | file.open("atm.txt",ios::in | ios::out | ios::ate); 248 | temp.open("temp.txt",ios::out | ios::app); 249 | file.seekg(0); 250 | file.read((char*)&a, sizeof(a)); 251 | while (!file.eof()) { // Till end of file is reached 252 | if (!strcmp(a.usernames(), uname)) { 253 | int b; 254 | cout << "\nEnter amount to withdraw:"; 255 | cin >> b; 256 | if (a.balance < b) { 257 | cout<< "\nInsufficient balance to withdraw"; 258 | } 259 | else { 260 | a.balance = a.balance - b; 261 | temp.write((char*)&a,sizeof(a)); 262 | cout << "\nBalance is:"<< a.balance; 263 | } 264 | } 265 | else { 266 | temp.write((char*)&a,sizeof(a)); 267 | } 268 | file.read((char*)&a, sizeof(a)); 269 | } 270 | file.close(); // Close the file 271 | temp.close(); 272 | remove("atm.txt"); 273 | rename("temp.txt", "atm.txt"); 274 | } 275 | 276 | int atm::search_specific_user(char* uname, int pass){ // Search user 277 | atm a; 278 | fstream f; 279 | f.open("atm.txt", ios::in); // Open the file 280 | if (!f) { 281 | cout << "Error in opening file.."; 282 | return 0; 283 | } 284 | f.read((char*)&a, sizeof(a)); // Read data from file 285 | while (!f.eof()) { 286 | if (!strcmp(a.usernames(), uname)) { 287 | if (a.passwords() == pass) { 288 | return 1; 289 | } 290 | } 291 | f.read((char*)&a, sizeof(a)); 292 | } 293 | f.close(); // Close the file 294 | return 0; 295 | } 296 | 297 | int atm::search_all_user_to_display(char* uname){ // Search specific user 298 | atm a; 299 | fstream file1; 300 | file1.open("atm.txt", ios::in); // Open the file 301 | if (!file1) { 302 | cout << "Error in opening file.."; 303 | return 0; 304 | } // Read data from file 305 | file1.read((char*)&a, sizeof(a)); 306 | while (!file1.eof()) { 307 | if (!strcmp(a.usernames(), uname)) { 308 | a.showData(); 309 | return 0; 310 | } 311 | file1.read((char*)&a, sizeof(a)); 312 | } 313 | // Close the file 314 | file1.close(); 315 | return 0; 316 | } 317 | 318 | // Driver Code 319 | //int main(){ 320 | // // Function Call 321 | // atmUser(); 322 | // return 0; 323 | //} 324 | 325 | -------------------------------------------------------------------------------- /OOP PROJECT/Bank_Management_system/project.h: -------------------------------------------------------------------------------- 1 | //#include 2 | #include 3 | #include //for system cls and sleep and goto back: functions. 4 | #include // for get function 5 | using namespace std; 6 | /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 7 | 8 | class Bank{ // Main class 9 | private: 10 | int total; 11 | string id; 12 | struct person{ // Inheritance Structure to store basic data. 13 | string name,ID,address; 14 | int contact,cash; 15 | }person[100]; // Array to store data. 16 | public: 17 | Bank(){ // Constructor 18 | total=0; 19 | void choice(); 20 | void Createaccount(); 21 | void show(); 22 | void update(); 23 | void search(); 24 | void transactions(); 25 | void del(); 26 | } 27 | 28 | void choice(){ 29 | int ch; 30 | while(1){ 31 | cout<<"PRESS FOLLOWIING OF YOUR CHOICE..!!"< Create new account"< View customers list"< Update information of existing account"< Check the details of an existing account"< For transactions"< Remove existing account"< Exit"<>person[total].name; 98 | cout<<"ID:"; 99 | cin>>person[total].ID; 100 | cout<<"Address:"; 101 | cin>>person[total].address; 102 | cout<<"Contact: "; 103 | cin>>person[total].contact; 104 | cout<<"Total Cash: "; 105 | cin>>person[total].cash; 106 | total++; 107 | } 108 | 109 | void show(){ // View customers list 110 | for(int i=0;i>id; 123 | for(int i=0;i>person[i].name; 135 | cout<<"ID: "; 136 | cin>>person[i].ID; 137 | cout<<"Address: "; 138 | cin>>person[i].address; 139 | cout<<"Contact: "; 140 | cin>>person[i].contact; 141 | cout<<"Total Cash: "; 142 | cin>>person[i].cash; 143 | break; 144 | } 145 | if(i==total-1){ //It is for any worng input those id which doesn't esixted. 146 | cout<<"No such record found"<>id; 154 | for(int i=0;i>id; 174 | for(int i=0;i>ch; 183 | ch=getch(); 184 | switch(ch){ 185 | case '1': 186 | cout<<"How much cash you want to deposit??"<>cash; 188 | person[i].cash+=cash; 189 | cout<<"Your new cash is "<>cash; // | 195 | if(cash>person[i].cash){ // | 196 | cout<<"Your existing cash is just "<>ch; 220 | ch=getch(); 221 | switch(ch){ 222 | case '1': 223 | cout<<"Enter id of person those data you want to remove"<>id; 225 | for(int i=0;i>username; 278 | 279 | cout<<"\t\tEnter new password: "; 280 | 281 | cin>>password; 282 | 283 | cout<<"\t\tYour new id is creating please wait"; 284 | 285 | for(int i=0;i<6;i++) 286 | 287 | { 288 | 289 | cout<<"."; 290 | 291 | Sleep(500); 292 | 293 | } 294 | 295 | cout<<"\n\t\tYour id created successfully"; 296 | 297 | Sleep(2000); 298 | 299 | start: 300 | 301 | system("CLS"); 302 | 303 | string usrn,pswd; 304 | 305 | cout<<"\n\n\t\tEmployee Management System"<>usrn; 312 | 313 | cout<<"\t\tEnter password: "; 314 | 315 | cin>>pswd; 316 | 317 | if(usrn==username&&pswd==password) 318 | 319 | { 320 | 321 | system("CLS"); 322 | 323 | char ch; 324 | 325 | }; 326 | 327 | 328 | -------------------------------------------------------------------------------- /OOP PROJECT/real/account.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define MAX 15 7 | #include "customer_end2.h" 8 | 9 | using namespace std; 10 | 11 | class account:public admin{ 12 | protected: 13 | char cust_name[MAX]; 14 | char acc_type[MAX]; 15 | int acc_num; 16 | double contact; 17 | double CNIC; 18 | public: 19 | void menu(); 20 | void display()=0; 21 | void create_ac()=0; 22 | void deposit()=0; 23 | void withdraw()=0; 24 | void intrest()=0; 25 | void balance()=0; 26 | }; 27 | 28 | class current: public account{ 29 | protected: 30 | float bal,initial_amt,amt,intr,CI; 31 | int num,dummy,years,n,w_slip,x; 32 | public: 33 | current(){ 34 | strcpy(acc_type,"Current Account."); 35 | acc_num=000; 36 | n=2; 37 | } 38 | //Static Acount number 39 | int gen_acc_num(){ 40 | static int s_nID = 1; 41 | return s_nID++; 42 | } 43 | // void virtual getdata() 44 | // { 45 | // cout<<"\nYour Acount number is: "; 46 | // x= gen_acc_num(); 47 | // cout<>cust_name; 50 | // } 51 | 52 | virtual void display(){ 53 | cout<<"----FULL DETAILS----\n"; 54 | cout<<"Customer Name: "<<"\t"<>cust_name; 70 | cout<<"Enter number of years the amount is deposited for: "; 71 | cin>>years; 72 | cout<<"Enter your contact number : "; 73 | cin>>contact; 74 | cout<>CNIC; 77 | cout<>amt; 81 | if(amt<500){ 82 | cout<<"Minimum deposit amount: Rs500\nTry Again\n"; 83 | goto retry; 84 | }else 85 | bal = amt; 86 | initial_amt=amt; 87 | } 88 | 89 | void virtual deposit(){ 90 | cout<<"Enter Account no.\n"; 91 | cin>>dummy; 92 | if(x==dummy){ 93 | cout<<"Enter the amount to deposit\n"; 94 | cin>>amt; 95 | bal +=amt; 96 | }else 97 | cout<<"Hacker! We've informed Police about this incident\n"; 98 | } 99 | 100 | void virtual withdraw(){ 101 | cout<<"Enter Account no.\n"; 102 | cin>>dummy; 103 | if(x==dummy){ 104 | cout<<"Enter the Withdraw slip no.\n"; 105 | cin>>w_slip; 106 | cout<<"\nEnter amount to be withdrawn: "; 107 | cin>>amt; 108 | if(bal <= 500) 109 | cout<<"Withdrwal not possible. Reached minimum balance\n"; 110 | else 111 | bal = bal - amt; 112 | }else 113 | cout<<"Hacker! We've informed Police about this incident\n"; 114 | } 115 | 116 | virtual void balance(){ 117 | cout<<"\nCurrent Balance: Rs"<>cust_name; 156 | cout<<"Enter number of years the amount is deposited for: "; 157 | cin>>years; 158 | cout<<"Enter your contact number : "; 159 | cin>>contact; 160 | cout<>CNIC; 163 | cout<>amt; 167 | if(amt<500){ 168 | cout<<"Minimum deposit amount: Rs500\nTry Again\n"; 169 | goto retry; 170 | }else 171 | bal = amt; 172 | initial_amt=amt; 173 | } 174 | 175 | void virtual deposit(){ 176 | cout<<"Enter Account no.\n"; 177 | cin>>dummy; 178 | if(x==dummy){ 179 | cout<<"Enter the amount to deposit\n"; 180 | cin>>amt; 181 | bal +=amt; 182 | }else 183 | cout<<"Hacker! We've informed Police about this incident\n"; 184 | } 185 | 186 | void virtual withdraw(){ 187 | cout<<"Enter Account no.\n"; 188 | cin>>dummy; 189 | if(x==dummy){ 190 | cout<<"Enter the Cheque no.\n"; 191 | cin>>c_no; 192 | cout<<"\nEnter amount to be withdrawn: "; 193 | cin>>amt; 194 | if(bal <= 500) 195 | cout<<"Withdrwal not possible. Reached minimum balance\n"; 196 | else 197 | bal = bal - amt; 198 | }else 199 | cout<<"Hacker! We've informed Police about this incident\n"; 200 | } 201 | 202 | virtual void balance(){ 203 | cout<<"\nCurrent Balance: Rs"<>ch; 214 | switch(ch) 215 | { 216 | case 1: //Savings Accout 217 | { 218 | int ch; 219 | current c; 220 | a=&c; 221 | while(1) 222 | { 223 | cout<<"\n\nCurrent Account Facilities\n"; 224 | cout<<"--------------------------\n"; 225 | cout<<"1.Create Accout\n2.Deposit Account\n3.Witdrawal\n"; 226 | cout<<"4.Balance\n5.Full Account Details\n6.Exit\n"; 227 | cout<<"Enter choice from menu to make transactions: \n"; 228 | cin>>ch; 229 | switch(ch) 230 | { 231 | case 1: 232 | a->create_ac(); 233 | break; 234 | case 2: 235 | a->deposit(); 236 | break; 237 | case 3: 238 | a->withdraw(); 239 | break; 240 | case 4: 241 | a->balance(); 242 | break; 243 | case 5: 244 | a->display(); 245 | break; 246 | case 6: 247 | goto back; 248 | default: cout<<"Invalid Input\n"; 249 | } 250 | } 251 | } 252 | case 2: //Savings Accout 253 | { 254 | int ch; 255 | savings s; 256 | a=&s; 257 | while(1){ 258 | cout<<"\n\nSavings Account Facilities\n"; 259 | cout<<"--------------------------\n"; 260 | cout<<"1.Create Accout\n2.Deposit Account\n3.Witdrawal\n"; 261 | cout<<"4.Balance\n5.Full Account Details\n6.Exit\n"; 262 | cout<<"Enter choice from menu to make transactions: \n"; 263 | cin>>ch; 264 | switch(ch){ 265 | case 1: 266 | a->create_ac(); 267 | break; 268 | case 2: 269 | a->deposit(); 270 | break; 271 | case 3: 272 | a->withdraw(); 273 | break; 274 | case 4: 275 | a->balance(); 276 | break; 277 | case 5: 278 | a->display(); 279 | break; 280 | case 6: 281 | goto back; 282 | default: cout<<"Invalid Input\n"; 283 | } 284 | } 285 | } 286 | case 3: 287 | exit(0); 288 | default: cout<<"Invalid Input\n"; 289 | } 290 | system("pause"); 291 | } 292 | -------------------------------------------------------------------------------- /OOP PROJECT/new.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #define MAX 15 7 | //#include "main.h" 8 | 9 | using namespace std; 10 | 11 | class account{ 12 | protected: 13 | char cust_name[MAX]; 14 | char acc_type[MAX]; 15 | int acc_num; 16 | double contact; 17 | double CNIC; 18 | public: 19 | void menu(); 20 | virtual void display()=0; 21 | virtual void create_ac()=0; 22 | virtual void deposit()=0; 23 | virtual void withdraw()=0; 24 | virtual void intrest()=0; 25 | virtual void balance()=0; 26 | }; 27 | 28 | class current: public account{ 29 | 30 | protected: 31 | float bal,initial_amt,amt,intr,CI; 32 | int num,dummy,years,n,w_slip,x; 33 | public: 34 | current(){ 35 | strcpy(acc_type,"Current Account."); 36 | acc_num=000; 37 | n=2; 38 | } 39 | //Static Acount number 40 | int gen_acc_num(){ 41 | static int s_nID = 1; 42 | return s_nID++; 43 | } 44 | // void virtual getdata() 45 | // { 46 | // cout<<"\nYour Acount number is: "; 47 | // x= gen_acc_num(); 48 | // cout<>cust_name; 51 | // } 52 | 53 | virtual void display(){ 54 | cout<<"----FULL DETAILS----\n"; 55 | cout<<"Customer Name: "<<"\t"<>cust_name; 71 | cout<<"Enter number of years the amount is deposited for: "; 72 | cin>>years; 73 | cout<<"Enter your contact number : "; 74 | cin>>contact; 75 | cout<>CNIC; 78 | cout<>amt; 82 | if(amt<500){ 83 | cout<<"Minimum deposit amount: Rs500\nTry Again\n"; 84 | goto retry; 85 | }else 86 | bal = amt; 87 | initial_amt=amt; 88 | } 89 | 90 | void virtual deposit(){ 91 | cout<<"Enter Account no.\n"; 92 | cin>>dummy; 93 | if(x==dummy){ 94 | cout<<"Enter the amount to deposit\n"; 95 | cin>>amt; 96 | bal +=amt; 97 | }else 98 | cout<<"Hacker! We've informed Police about this incident\n"; 99 | } 100 | 101 | void virtual withdraw(){ 102 | cout<<"Enter Account no.\n"; 103 | cin>>dummy; 104 | if(x==dummy){ 105 | cout<<"Enter the Withdraw slip no.\n"; 106 | cin>>w_slip; 107 | cout<<"\nEnter amount to be withdrawn: "; 108 | cin>>amt; 109 | if(bal <= 500) 110 | cout<<"Withdrwal not possible. Reached minimum balance\n"; 111 | else 112 | bal = bal - amt; 113 | }else 114 | cout<<"Hacker! We've informed Police about this incident\n"; 115 | } 116 | 117 | virtual void balance(){ 118 | cout<<"\nCurrent Balance: Rs"<>cust_name; 157 | cout<<"Enter number of years the amount is deposited for: "; 158 | cin>>years; 159 | cout<<"Enter your contact number : "; 160 | cin>>contact; 161 | cout<>CNIC; 164 | cout<>amt; 168 | if(amt<500){ 169 | cout<<"Minimum deposit amount: Rs500\nTry Again\n"; 170 | goto retry; 171 | }else 172 | bal = amt; 173 | initial_amt=amt; 174 | } 175 | 176 | void virtual deposit(){ 177 | cout<<"Enter Account no.\n"; 178 | cin>>dummy; 179 | if(x==dummy){ 180 | cout<<"Enter the amount to deposit\n"; 181 | cin>>amt; 182 | bal +=amt; 183 | }else 184 | cout<<"Hacker! We've informed Police about this incident\n"; 185 | } 186 | 187 | void virtual withdraw(){ 188 | cout<<"Enter Account no.\n"; 189 | cin>>dummy; 190 | if(x==dummy){ 191 | cout<<"Enter the Cheque no.\n"; 192 | cin>>c_no; 193 | cout<<"\nEnter amount to be withdrawn: "; 194 | cin>>amt; 195 | if(bal <= 500) 196 | cout<<"Withdrwal not possible. Reached minimum balance\n"; 197 | else 198 | bal = bal - amt; 199 | }else 200 | cout<<"Hacker! We've informed Police about this incident\n"; 201 | } 202 | 203 | virtual void balance(){ 204 | cout<<"\nCurrent Balance: Rs"<>ch; 215 | switch(ch) 216 | { 217 | case 1: //Savings Accout 218 | { 219 | int ch; 220 | // current c; 221 | // a=&c; 222 | while(1) 223 | { 224 | cout<<"\n\nCurrent Account Facilities\n"; 225 | cout<<"--------------------------\n"; 226 | cout<<"1.Create Accout\n2.Deposit Account\n3.Witdrawal\n"; 227 | cout<<"4.Balance\n5.Full Account Details\n6.Exit\n"; 228 | cout<<"Enter choice from menu to make transactions: \n"; 229 | cin>>ch; 230 | switch(ch) 231 | { 232 | case 1: 233 | a->create_ac(); 234 | break; 235 | case 2: 236 | a->deposit(); 237 | break; 238 | case 3: 239 | a->withdraw(); 240 | break; 241 | case 4: 242 | a->balance(); 243 | break; 244 | case 5: 245 | a->display(); 246 | break; 247 | case 6: 248 | goto back; 249 | default: cout<<"Invalid Input\n"; 250 | } 251 | } 252 | } 253 | case 2: //Savings Accout 254 | { 255 | int ch; 256 | // savings s; 257 | // a=&s; 258 | while(1){ 259 | cout<<"\n\nSavings Account Facilities\n"; 260 | cout<<"--------------------------\n"; 261 | cout<<"1.Create Accout\n2.Deposit Account\n3.Witdrawal\n"; 262 | cout<<"4.Balance\n5.Full Account Details\n6.Exit\n"; 263 | cout<<"Enter choice from menu to make transactions: \n"; 264 | cin>>ch; 265 | switch(ch){ 266 | case 1: 267 | a->create_ac(); 268 | break; 269 | case 2: 270 | a->deposit(); 271 | break; 272 | case 3: 273 | a->withdraw(); 274 | break; 275 | case 4: 276 | a->balance(); 277 | break; 278 | case 5: 279 | a->display(); 280 | break; 281 | case 6: 282 | goto back; 283 | default: cout<<"Invalid Input\n"; 284 | } 285 | } 286 | } 287 | case 3: 288 | exit(0); 289 | default: cout<<"Invalid Input\n"; 290 | } 291 | system("pause"); 292 | } 293 | -------------------------------------------------------------------------------- /OOP PROJECT/real/customer_end2.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "account.h" 8 | 9 | using namespace std; 10 | 11 | class admin{ 12 | int accNo; 13 | char name[50]; 14 | char city[50]; 15 | int deposit,x; 16 | double contact; 17 | double CNIC; 18 | string statius; 19 | char type; 20 | public: 21 | void createAccount(); 22 | void displayAccount() const; 23 | void modify(); 24 | void dep(int); 25 | void draw(int); 26 | void report() const; 27 | int retaccNo() const; 28 | int retdeposit() const; 29 | char rettype() const; 30 | void menulist(); 31 | }; 32 | 33 | 34 | int gen_acc_num(){ //This FUnction is used to create an Account of User. 35 | static int s_nID = 1; 36 | return s_nID++; 37 | } 38 | 39 | void admin::createAccount(){ 40 | system("cls"); 41 | cout<>contact; 52 | cout<>CNIC; 55 | cout<>deposit; 58 | cout<>type; 61 | if(type==c){ 62 | account ac; 63 | ac.menu(); 64 | } 65 | 66 | // cout<<"\t\t\tAccount Created.."; 67 | } 68 | 69 | void admin::displayAccount() const{ //display Account FUnction. 70 | cout<<"\n\t\t\tAccount No. : "<>type; 84 | type=toupper(type); 85 | cout<<"\n\t\t\tModify Balance amount : "; 86 | cin>>deposit; 87 | } 88 | 89 | 90 | void admin::dep(int x){ 91 | deposit+=x; 92 | } 93 | 94 | void admin::draw(int x){ 95 | deposit-=x; 96 | } 97 | 98 | void admin::report() const{ 99 | cout< (&ad), sizeof(admin)); 121 | outFile.close(); 122 | } 123 | 124 | 125 | void display_sp(int n){ 126 | admin ad; 127 | bool flag=false; 128 | ifstream inFile; 129 | inFile.open("admin.txt",ios::binary); 130 | if(!inFile){ 131 | cout<<"File could not be open !! Press any Key..."; 132 | // return; 133 | } 134 | cout<<"\n\t\t\tBALANCE DETAILS\n"; 135 | while(inFile.read(reinterpret_cast (&ad), sizeof(admin))){ 136 | if(ad.retaccNo()==n){ 137 | ad.displayAccount(); 138 | flag=true; 139 | } 140 | } 141 | inFile.close(); 142 | if(flag==false){ 143 | cout<<"\n\n\t\t\tAccount number does not exist"; 144 | } 145 | } 146 | 147 | 148 | 149 | void modifyAccount(int n){ 150 | bool found=false; 151 | admin ad; 152 | fstream File; 153 | File.open("admin.txt",ios::binary|ios::in|ios::out); 154 | if(!File) 155 | { 156 | cout<<"File could not be open !! Press any Key..."; 157 | return; 158 | } 159 | while(!File.eof()){ //&& found==false 160 | File.read(reinterpret_cast (&ad), sizeof(admin)); 161 | if(ad.retaccNo()==n) 162 | { 163 | ad.displayAccount(); 164 | cout<<"\n\n\t\t\tEnter The New Details of account"<(sizeof(admin)); 167 | File.seekp(pos,ios::cur); //fncallat1353 168 | File.write(reinterpret_cast (&ad), sizeof(admin)); 169 | cout<<"\n\n\t\t\tRecord Updated"; 170 | found=true; 171 | } 172 | } 173 | File.close(); 174 | if(found==false) 175 | cout<<"\n\n\t\t\tRecord Not Found "; 176 | } 177 | 178 | 179 | void deleteAccount(int n){ 180 | admin ad; 181 | ifstream inFile; 182 | ofstream outFile; 183 | inFile.open("admin.txt",ios::binary); 184 | if(!inFile){ 185 | cout<<"File could not be open !! Press any Key..."; 186 | return; 187 | } 188 | outFile.open("Temp.txt",ios::binary); 189 | inFile.seekg(0,ios::beg); 190 | while(inFile.read(reinterpret_cast (&ad), sizeof(admin))){ 191 | if(ad.retaccNo()!=n){ 192 | outFile.write(reinterpret_cast (&ad), sizeof(admin)); 193 | } 194 | } 195 | inFile.close(); 196 | outFile.close(); 197 | remove("admin.txt"); 198 | rename("Temp.txt","admin.txt"); 199 | cout<<"\n\n\t\tRecord Deleted .."; 200 | } 201 | 202 | 203 | void displayRecords(){ 204 | system("cls"); 205 | admin ad; 206 | ifstream inFile; 207 | inFile.open("admin.txt",ios::binary); 208 | if(!inFile){ 209 | cout<<"File could not be open !! Press any Key..."; 210 | return; 211 | } 212 | cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; 213 | cout<<"====================================================\n"; 214 | cout<<"A/c no. NAME Type Balance\n"; 215 | cout<<"====================================================\n"; 216 | while(inFile.read(reinterpret_cast (&ad), sizeof(admin))){ 217 | ad.report(); 218 | } 219 | inFile.close(); 220 | } 221 | 222 | void deposit_withdraw(int n, int option){ 223 | int amt; 224 | bool found=false; 225 | admin ad; 226 | fstream File; 227 | File.open("admin.txt", ios::binary|ios::in|ios::out); 228 | if(!File){ 229 | cout<<"File could not be open !! Press any Key..."; 230 | return; 231 | } 232 | while(!File.eof() && found==false){ 233 | File.read(reinterpret_cast (&ad), sizeof(admin)); 234 | if(ad.retaccNo()==n){ 235 | ad.displayAccount(); 236 | if(option==1){ 237 | cout<<"\n\n\t\t\tEnter The amount to be deposited: "; 238 | cin>>amt; 239 | ad.dep(amt); 240 | } 241 | if(option==2){ 242 | cout<<"\n\n\t\t\tEnter The amount to be withdraw: "; 243 | cin>>amt; 244 | int bal=ad.retdeposit()-amt; 245 | if(bal<0) 246 | cout<<"Sorry !! Insufficience balance.."; 247 | else 248 | ad.draw(amt); 249 | } 250 | int pos=(-1)*static_cast(sizeof(ad)); 251 | File.seekp(pos,ios::cur);//fn1353 252 | File.write(reinterpret_cast (&ad), sizeof(admin)); 253 | cout<<"\n\n\t\t\tSuccess... Record Updated Successfully"; 254 | found=true; 255 | } 256 | } 257 | File.close(); 258 | if(found==false) 259 | cout<<"\n\n\t\t\tOops! We Couldn't find your record"; 260 | } 261 | 262 | 263 | // MenuList of Project 264 | 265 | 266 | void menulist(){ 267 | char ch; 268 | int num; 269 | do{ 270 | system("cls"); 271 | cout<<"\n\n\t\t\t\t==============================\n"; 272 | cout<<"\t\t\t\t| BANK MANAGEMENT SYSTEM |"; 273 | cout<<"\n\t\t\t\t==============================\n"; 274 | cout<>ch; 287 | switch(ch){ 288 | case '1': 289 | accountDetails(); 290 | break; 291 | case '2': 292 | system("cls"); 293 | cout<<"\n\n\t\t\tEnter The account No. : "; 294 | cin>>num; 295 | deposit_withdraw(num, 1); 296 | break; 297 | case '3': 298 | system("cls"); 299 | cout<<"\n\n\t\t\tEnter The account No. : "; 300 | cin>>num; 301 | deposit_withdraw(num, 2); 302 | break; 303 | case '4': 304 | system("cls"); 305 | cout<<"\n\n\t\t\tEnter The account No. : "; 306 | cin>>num; 307 | display_sp(num); 308 | break; 309 | case '5': 310 | displayRecords(); 311 | break; 312 | case '6': 313 | system("cls"); 314 | cout<<"\n\n\t\t\tEnter The account No. : "; 315 | cin>>num; 316 | deleteAccount(num); 317 | break; 318 | case '7': 319 | system("cls"); 320 | cout<<"\n\n\t\t\tEnter The account No. : "; 321 | cin>>num; 322 | modifyAccount(num); 323 | break; 324 | case '8': 325 | system("cls"); 326 | cout<<"\n\n\t\t\tThank You For Banking With WOI-BANK...."; 327 | break; 328 | default :cout<<"\a"; 329 | } 330 | cin.ignore(); 331 | cin.get(); 332 | }while(ch!='8'); 333 | } 334 | 335 | //int main(){ 336 | // admin add; 337 | // add.menulist(); 338 | // return 0; 339 | //} 340 | -------------------------------------------------------------------------------- /OOP PROJECT/Bank_Management_system/ATM.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include //for system cls and sleep and goto back: functions. 8 | #include // for get function 9 | using namespace std; 10 | 11 | // Class ATM to get user details 12 | class atm { 13 | private: 14 | char username[30]; 15 | int password; 16 | int balance; 17 | 18 | public: 19 | char* usernames(void){ 20 | // Return username 21 | return username; 22 | } 23 | 24 | int passwords(void){ 25 | // Return the password 26 | return password; 27 | } 28 | 29 | // Function to get the data 30 | void getData(void){ 31 | cin.ignore(numeric_limits::max(),'\n'); 32 | cout << "\nEnter username:"; 33 | cin.getline(username, 30); 34 | cout << "\nEnter 4-digit password:"; 35 | cin >> password; 36 | cin.ignore(numeric_limits::max(),'\n'); 37 | cout << "\nEnter initial balance:"; 38 | cin >> balance; 39 | cin.ignore(numeric_limits::max(),'\n'); 40 | } 41 | 42 | // Function displaying the data 43 | void showData(void){ 44 | cout << "Username:" << username< Admin\n2->User\n3->Exit\nChoose one : "; 70 | cin >> ch; 71 | 72 | switch (ch) { 73 | case 1: 74 | rerun: 75 | system("cls"); 76 | cout << "\nEnter details to login as Admin..!!\n"; 77 | cout << "\nEnter password:"; 78 | cin >> pass; 79 | if (pass == 1234) { 80 | admin: 81 | system("cls"); 82 | cout << "\nWelcome to Admin Menu..!"<Add User\n2.->Delete User\n3->View All User\n4->Exit\n"; 84 | cout << "\nSelect one : "; 85 | cin >> ch1; 86 | switch (ch1) { 87 | case 1: 88 | a.add_user(); 89 | goto admin; 90 | 91 | case 2: 92 | cout << "\nEnter the Username to be deleted : "<::max(),'\n'); 94 | cin.getline(uname, 30); 95 | a.delete_user(uname); 96 | goto admin; 97 | 98 | case 3: 99 | a.view_all_users(); 100 | sleep(4); 101 | goto admin; 102 | 103 | case 4: 104 | break; 105 | } 106 | } 107 | else { 108 | cout << "\nDetails are incorrect ! Please try again....."; 109 | cin.get(); 110 | goto rerun; 111 | } 112 | goto mainmenu; 113 | 114 | case 2: 115 | system("cls"); 116 | cout << "\n Enter details to login as User\n"; 117 | 118 | cin.ignore(numeric_limits::max(),'\n'); 119 | cout << "Enter username:"; 120 | cin.getline(uname, 30); 121 | cout << "\nEnter password:"; 122 | 123 | cin >> pass; 124 | found = a.search_specific_user(uname, pass); 125 | 126 | if (found) { 127 | user: 128 | system("cls"); 129 | cout << "\nWelcome "<< uname; 130 | cout << "\nWelcome to User Menu..!!"; 131 | cout << "\n1->Deposit\n2->Withdraw\n3->View Account\n4->Exit\nEnter your choice:"; 132 | cin >> ch2; 133 | switch (ch2) { 134 | case 1: 135 | a.update_user_as_deposit(uname); 136 | goto user; 137 | case 2: 138 | a.update_user_as_withdraw(uname); 139 | goto user; 140 | case 3: 141 | a.search_all_user_to_display(uname); 142 | sleep(4); 143 | goto user; 144 | case 4: 145 | cout << "Thank you"; 146 | break; 147 | } 148 | } 149 | else { 150 | cout << "\nNo account found with username "<< uname<<":(\n\nHit ENTER to continue "; 151 | cin.get(); 152 | } 153 | goto mainmenu; 154 | 155 | case 3: 156 | cout << "\nThankyou for banking with WOI-BANK"; 157 | cin.get(); 158 | break; 159 | } 160 | } 161 | 162 | // Function to add user 163 | int atm::add_user(){ 164 | atm a; 165 | ofstream file; 166 | 167 | // Open file in write mode 168 | file.open("aaa.txt",ios::out | ios::app); 169 | if (!file) { 170 | cout << "Error in creating file.." << endl; 171 | return 0; 172 | } 173 | // Read from user 174 | a.getData(); 175 | 176 | // Write into file 177 | file.write((char*)&a, sizeof(a)); 178 | // Close the file 179 | file.close(); 180 | return 0; 181 | } 182 | 183 | // View Users 184 | int atm::view_all_users(){ 185 | atm a; 186 | ifstream file1; 187 | 188 | // Open file in read mode 189 | file1.open("aaa.txt", ios::in); 190 | if (!file1) { 191 | cout << "Error in opening file.."; 192 | return 0; 193 | } 194 | 195 | // Read data from file 196 | file1.read((char*)&a, sizeof(a)); 197 | while (!file1.eof()) { 198 | // Display data on monitor 199 | a.showData(); 200 | file1.read((char*)&a, sizeof(a)); 201 | } 202 | 203 | // Close the file 204 | file1.close(); 205 | return 0; 206 | } 207 | 208 | // Function to delete the user 209 | int atm::delete_user(char* uname){ 210 | atm a; 211 | fstream original, temp; 212 | original.open("aaa.txt", ios::in); 213 | if (!original) { 214 | cout << "\nfile not found"; 215 | return 0; 216 | } 217 | else { 218 | temp.open("temp.txt",ios::out | ios::app); 219 | original.read((char*)&a, sizeof(a)); 220 | 221 | // Till end of file is reached 222 | while (!original.eof()) { 223 | if (!strcmp(a.usernames(),uname)) { 224 | cout << "data found and deleted\n"<< a.username<<"\n"; 225 | } 226 | else { 227 | temp.write((char*)&a,sizeof(a)); 228 | } 229 | original.read((char*)&a,sizeof(a)); 230 | } 231 | original.close(); 232 | temp.close(); 233 | remove("atm.txt"); 234 | rename("temp.txt", "atm.txt"); 235 | a.view_all_users(); 236 | } 237 | return 0; 238 | } 239 | 240 | // Function to update user by 241 | // depositing money 242 | void atm::update_user_as_deposit(char* uname){ 243 | atm a; 244 | fstream file, temp; 245 | 246 | file.open("aaa.txt",ios::in | ios::out | ios::ate); 247 | temp.open("temp.txt",ios::out | ios::app); 248 | file.seekg(0); 249 | file.read((char*)&a, sizeof(a)); 250 | 251 | // Till end of the file 252 | while (!file.eof()) { 253 | if (!strcmp(a.usernames(), uname)) { 254 | int b; 255 | cout << "\nEnter amount to deposit:"; 256 | cin >> b; 257 | a.balance = a.balance + b; 258 | cout << "\nBalance is:"<< a.balance; 259 | temp.write((char*)&a, sizeof(a)); 260 | } 261 | else { 262 | temp.write((char*)&a, sizeof(a)); 263 | } 264 | file.read((char*)&a, sizeof(a)); 265 | } 266 | file.close(); 267 | temp.close(); 268 | remove("atm.txt"); 269 | rename("temp.txt", "atm.txt"); 270 | } 271 | 272 | // Function to update user by 273 | // depositing withdrawing money 274 | void atm::update_user_as_withdraw(char* uname){ 275 | atm a; 276 | fstream file, temp; 277 | 278 | file.open("atm.txt",ios::in | ios::out | ios::ate); 279 | temp.open("temp.txt",ios::out | ios::app); 280 | file.seekg(0); 281 | file.read((char*)&a, sizeof(a)); 282 | 283 | // Till end of file is reached 284 | while (!file.eof()) { 285 | if (!strcmp(a.usernames(), uname)) { 286 | int b; 287 | cout << "\nEnter amount to withdraw:"; 288 | cin >> b; 289 | if (a.balance < b) { 290 | cout<< "\nInsufficient balance to withdraw"; 291 | } 292 | else { 293 | a.balance = a.balance - b; 294 | temp.write((char*)&a,sizeof(a)); 295 | cout << "\nBalance is:"<< a.balance; 296 | } 297 | } 298 | else { 299 | temp.write((char*)&a,sizeof(a)); 300 | } 301 | file.read((char*)&a, sizeof(a)); 302 | } 303 | 304 | // Close the file 305 | file.close(); 306 | temp.close(); 307 | remove("atm.txt"); 308 | rename("temp.txt", "atm.txt"); 309 | } 310 | 311 | // Search user 312 | int atm::search_specific_user(char* uname, int pass){ 313 | atm a; 314 | fstream f; 315 | 316 | // Open the file 317 | f.open("atm.txt", ios::in); 318 | if (!f) { 319 | cout << "Error in opening file.."; 320 | return 0; 321 | } 322 | 323 | // Read data from file 324 | f.read((char*)&a, sizeof(a)); 325 | while (!f.eof()) { 326 | if (!strcmp(a.usernames(), uname)) { 327 | if (a.passwords() == pass) { 328 | return 1; 329 | } 330 | } 331 | f.read((char*)&a, sizeof(a)); 332 | } 333 | 334 | // Close the file 335 | f.close(); 336 | return 0; 337 | } 338 | 339 | // Search specific user 340 | int atm::search_all_user_to_display(char* uname){ 341 | atm a; 342 | fstream file1; 343 | 344 | // Open the file 345 | file1.open("atm.txt", ios::in); 346 | if (!file1) { 347 | cout << "Error in opening file.."; 348 | return 0; 349 | } 350 | 351 | // Read data from file 352 | file1.read((char*)&a, sizeof(a)); 353 | while (!file1.eof()) { 354 | if (!strcmp(a.usernames(), uname)) { 355 | 356 | a.showData(); 357 | return 0; 358 | } 359 | file1.read((char*)&a, sizeof(a)); 360 | } 361 | 362 | // Close the file 363 | file1.close(); 364 | return 0; 365 | } 366 | 367 | // Driver Code 368 | int main(){ 369 | // Function Call 370 | atmUser(); 371 | 372 | return 0; 373 | } 374 | 375 | -------------------------------------------------------------------------------- /OOP PROJECT/PROJECT/Bank-Management-System-main/ATM.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include //for system cls and sleep and goto back: functions. 7 | #include // for get function 8 | 9 | using namespace std; 10 | 11 | class atm{ 12 | private: 13 | char username[30]; 14 | int password; 15 | int balance; 16 | 17 | public: 18 | char* usernames(void){ 19 | return username; 20 | } 21 | 22 | int passwords(void){ 23 | return password; 24 | } 25 | 26 | 27 | void getData(void){ // Function to get the data (getter) 28 | cin.ignore(numeric_limits::max(),'\n'); 29 | cout << "\nEnter username:"; 30 | cin.getline(username, 30); 31 | cout << "\nEnter 4-digit password:"; 32 | cin >> password; 33 | cin.ignore(numeric_limits::max(),'\n'); 34 | cout << "\nEnter initial balance:"; 35 | cin >> balance; 36 | cin.ignore(numeric_limits::max(),'\n'); 37 | } 38 | 39 | void showData(void){ // Function displaying the data (setter) 40 | cout << "Username:" << username<> ATM SYSTEM LOGIN AS: <<" << endl; 64 | cout << "\t\t\t\t\t-------------------------------" << endl; 65 | cout << "\t\t\t\t\t 1. Admin" << endl; 66 | cout << "\t\t\t\t\t 2. User" << endl; 67 | 68 | cout << "\t\t\t\t\t.................................." << endl; 69 | cout << "\t\t\t\t\t>> Choice Options: [1/2] <<" << endl; 70 | cout << "\t\t\t\t\t.................................." << endl; 71 | cout << "\t\t\t\t\t Enter Your Choice: "; // Taking the action input 72 | cin >> ch; 73 | 74 | switch (ch) { 75 | case 1: 76 | rerun: 77 | system("cls"); 78 | cout << "\nEnter details to login as Admin..!!\n"; 79 | cout << "\nEnter password:"; 80 | cin >> pass; 81 | if (pass == 1234) { 82 | admin: 83 | system("cls"); 84 | cout << "\nWelcome to Admin Menu..!"<Add User\n2.->Delete User\n3->View All User\n4->Exit\n"; 86 | cout << "\nSelect one : "; 87 | cin >> ch1; 88 | switch (ch1) { 89 | case 1: 90 | a.add_user(); 91 | goto admin; 92 | 93 | case 2: 94 | cout << "\nEnter the Username to be deleted : "<::max(),'\n'); 96 | cin.getline(uname, 30); 97 | a.delete_user(uname); 98 | goto admin; 99 | 100 | case 3: 101 | a.view_all_users(); 102 | sleep(4); 103 | goto admin; 104 | 105 | case 4: 106 | break; 107 | } 108 | } 109 | else { 110 | cout << "\nDetails are incorrect ! Please try again....."; 111 | cin.get(); 112 | goto rerun; 113 | } 114 | goto mainmenu; 115 | 116 | case 2: 117 | system("cls"); 118 | cout << "\n Enter details to login as User\n"; 119 | cin.ignore(numeric_limits::max(),'\n'); 120 | cout << "Enter username:"; 121 | cin.getline(uname, 30); 122 | cout << "\nEnter password:"; 123 | cin >> pass; 124 | found = a.search_specific_user(uname, pass); 125 | if (found) { 126 | user: 127 | system("cls"); 128 | cout << "\nWelcome "<< uname; 129 | cout << "\nWelcome to User Menu..!!"; 130 | cout << "\n1->Deposit\n2->Withdraw\n3->View Account\n4->Exit\nEnter your choice:"; 131 | cin >> ch2; 132 | switch (ch2) { 133 | case 1: 134 | a.update_user_as_deposit(uname); 135 | goto user; 136 | case 2: 137 | a.update_user_as_withdraw(uname); 138 | goto user; 139 | case 3: 140 | a.search_all_user_to_display(uname); 141 | sleep(4); 142 | goto user; 143 | case 4: 144 | cout << "Thank you"; 145 | break; 146 | } 147 | } 148 | else { 149 | cout << "\nNo account found with username "<> b; 233 | a.balance = a.balance + b; 234 | cout << "\nBalance is:"<< a.balance; 235 | temp.write((char*)&a, sizeof(a)); 236 | } 237 | else { 238 | temp.write((char*)&a, sizeof(a)); 239 | } 240 | file.read((char*)&a, sizeof(a)); 241 | } 242 | file.close(); 243 | temp.close(); 244 | remove("atm.txt"); 245 | rename("temp.txt", "atm.txt"); 246 | } 247 | 248 | void atm::update_user_as_withdraw(char* uname){ // Function to update user by 249 | atm a; // depositing withdrawing user givcen amount 250 | fstream file, temp; 251 | file.open("atm.txt",ios::in | ios::out | ios::ate); 252 | temp.open("temp.txt",ios::out | ios::app); 253 | file.seekg(0); 254 | file.read((char*)&a, sizeof(a)); 255 | while (!file.eof()) { // Till end of file is reached 256 | if (!strcmp(a.usernames(), uname)) { 257 | int b; 258 | cout << "\nEnter amount to withdraw:"; 259 | cin >> b; 260 | if (a.balance < b) { 261 | cout<< "\nInsufficient balance to withdraw"; 262 | } 263 | else { 264 | a.balance = a.balance - b; 265 | temp.write((char*)&a,sizeof(a)); 266 | cout << "\nBalance is:"<< a.balance; 267 | } 268 | } 269 | else { 270 | temp.write((char*)&a,sizeof(a)); 271 | } 272 | file.read((char*)&a, sizeof(a)); 273 | } 274 | file.close(); // Close the file 275 | temp.close(); 276 | remove("atm.txt"); 277 | rename("temp.txt", "atm.txt"); 278 | } 279 | 280 | int atm::search_specific_user(char* uname, int pass){ // Search user 281 | atm a; 282 | fstream f; 283 | f.open("atm.txt", ios::in); // Open the file 284 | if (!f) { 285 | cout << "Error in opening file.."; 286 | return 0; 287 | } 288 | f.read((char*)&a, sizeof(a)); // Read data from file 289 | while (!f.eof()) { 290 | if (!strcmp(a.usernames(), uname)) { 291 | if (a.passwords() == pass) { 292 | return 1; 293 | } 294 | } 295 | f.read((char*)&a, sizeof(a)); 296 | } 297 | f.close(); // Close the file 298 | return 0; 299 | } 300 | 301 | int atm::search_all_user_to_display(char* uname){ // Search specific user 302 | atm a; 303 | fstream file1; 304 | file1.open("atm.txt", ios::in); // Open the file 305 | if (!file1) { 306 | cout << "Error in opening file.."; 307 | return 0; 308 | } // Read data from file 309 | file1.read((char*)&a, sizeof(a)); 310 | while (!file1.eof()) { 311 | if (!strcmp(a.usernames(), uname)) { 312 | a.showData(); 313 | return 0; 314 | } 315 | file1.read((char*)&a, sizeof(a)); 316 | } 317 | // Close the file 318 | file1.close(); 319 | return 0; 320 | } 321 | 322 | // Driver Code 323 | //int main(){ 324 | // // Function Call 325 | // atmUser(); 326 | // return 0; 327 | //} 328 | 329 | -------------------------------------------------------------------------------- /OOP PROJECT/PROJECT/BankManagement.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class account{ 11 | int accNo; 12 | char name[50]; 13 | char city[50]; 14 | int deposit; 15 | double contact; 16 | double CNIC; 17 | string statius; 18 | char type; 19 | public: 20 | void createAccount(); 21 | void displayAccount() const; 22 | void modify(); 23 | void dep(int); 24 | void draw(int); 25 | void report() const; 26 | int retaccNo() const; 27 | int retdeposit() const; 28 | char rettype() const; 29 | }; 30 | 31 | 32 | //This FUnction is used to create an Account of User. 33 | 34 | void account::createAccount() 35 | { 36 | system("cls"); 37 | cout<>accNo; 40 | cout<>contact; 47 | cout<>CNIC; 50 | cout<>type; 53 | type=toupper(type); 54 | cout<>deposit; 57 | cout<>type; 83 | type=toupper(type); 84 | cout<<"\n\t\t\tModify Balance amount : "; 85 | cin>>deposit; 86 | } 87 | 88 | 89 | void account::dep(int x) 90 | { 91 | deposit+=x; 92 | } 93 | 94 | void account::draw(int x) 95 | { 96 | deposit-=x; 97 | } 98 | 99 | void account::report() const 100 | { 101 | cout< (&ac), sizeof(account)); 128 | outFile.close(); 129 | } 130 | 131 | 132 | void display_sp(int n) 133 | { 134 | account ac; 135 | bool flag=false; 136 | ifstream inFile; 137 | inFile.open("account.dat",ios::binary); 138 | if(!inFile) 139 | { 140 | cout<<"File could not be open !! Press any Key..."; 141 | return; 142 | } 143 | cout<<"\n\t\t\tBALANCE DETAILS\n"; 144 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 145 | { 146 | if(ac.retaccNo()==n) 147 | { 148 | ac.displayAccount(); 149 | flag=true; 150 | } 151 | } 152 | inFile.close(); 153 | if(flag==false){ 154 | cout<<"\n\n\t\t\tAccount number does not exist"; 155 | } 156 | 157 | } 158 | 159 | 160 | 161 | void modifyAccount(int n) 162 | { 163 | bool found=false; 164 | account ac; 165 | fstream File; 166 | File.open("account.dat",ios::binary|ios::in|ios::out); 167 | if(!File) 168 | { 169 | cout<<"File could not be open !! Press any Key..."; 170 | return; 171 | } 172 | while(!File.eof() && found==false) 173 | { 174 | File.read(reinterpret_cast (&ac), sizeof(account)); 175 | if(ac.retaccNo()==n) 176 | { 177 | ac.displayAccount(); 178 | cout<<"\n\n\t\t\tEnter The New Details of account"<(sizeof(account)); 181 | File.seekp(pos,ios::cur); //fncallat1353 182 | File.write(reinterpret_cast (&ac), sizeof(account)); 183 | cout<<"\n\n\t\t\tRecord Updated"; 184 | found=true; 185 | } 186 | } 187 | File.close(); 188 | if(found==false) 189 | cout<<"\n\n\t\t\tRecord Not Found "; 190 | } 191 | 192 | 193 | void deleteAccount(int n) 194 | { 195 | account ac; 196 | ifstream inFile; 197 | ofstream outFile; 198 | inFile.open("account.dat",ios::binary); 199 | if(!inFile) 200 | { 201 | cout<<"File could not be open !! Press any Key..."; 202 | return; 203 | } 204 | outFile.open("Temp.dat",ios::binary); 205 | inFile.seekg(0,ios::beg); 206 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 207 | { 208 | if(ac.retaccNo()!=n) 209 | { 210 | outFile.write(reinterpret_cast (&ac), sizeof(account)); 211 | } 212 | } 213 | inFile.close(); 214 | outFile.close(); 215 | remove("account.dat"); 216 | rename("Temp.dat","account.dat"); 217 | cout<<"\n\n\t\tRecord Deleted .."; 218 | } 219 | 220 | 221 | void displayRecords() 222 | { 223 | system("cls"); 224 | account ac; 225 | ifstream inFile; 226 | inFile.open("account.dat",ios::binary); 227 | if(!inFile) 228 | { 229 | cout<<"File could not be open !! Press any Key..."; 230 | return; 231 | } 232 | cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; 233 | cout<<"====================================================\n"; 234 | cout<<"A/c no. NAME Type Balance\n"; 235 | cout<<"====================================================\n"; 236 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 237 | { 238 | ac.report(); 239 | } 240 | inFile.close(); 241 | } 242 | void deposit_withdraw(int n, int option) 243 | { 244 | int amt; 245 | bool found=false; 246 | account ac; 247 | fstream File; 248 | File.open("account.dat", ios::binary|ios::in|ios::out); 249 | if(!File) 250 | { 251 | cout<<"File could not be open !! Press any Key..."; 252 | return; 253 | } 254 | while(!File.eof() && found==false) 255 | { 256 | File.read(reinterpret_cast (&ac), sizeof(account)); 257 | if(ac.retaccNo()==n) 258 | { 259 | ac.displayAccount(); 260 | if(option==1) 261 | { 262 | //cout<<"\n\n\t\t\tTO DEPOSITSS AMOUNT"; 263 | cout<<"\n\n\t\t\tEnter The amount to be deposited: "; 264 | cin>>amt; 265 | ac.dep(amt); 266 | } 267 | if(option==2) 268 | { 269 | //cout<<"\n\n\t\t\tTO WITHDRAW AMOUNT"; 270 | cout<<"\n\n\t\t\tEnter The amount to be withdraw: "; 271 | cin>>amt; 272 | int bal=ac.retdeposit()-amt; 273 | if(bal<0) 274 | cout<<"Sorry !! Insufficience balance.."; 275 | else 276 | ac.draw(amt); 277 | } 278 | int pos=(-1)*static_cast(sizeof(ac)); 279 | File.seekp(pos,ios::cur);//fn1353 280 | File.write(reinterpret_cast (&ac), sizeof(account)); 281 | cout<<"\n\n\t\t\tSuccess... Record Updated Successfully"; 282 | found=true; 283 | } 284 | } 285 | File.close(); 286 | if(found==false) 287 | cout<<"\n\n\t\t\tOops! We Couldn't find your record"; 288 | } 289 | 290 | 291 | // MenuList of Project 292 | 293 | 294 | void menulist(){ 295 | char ch; 296 | int num; 297 | do 298 | { 299 | system("cls"); 300 | cout<<"\n\n\t\t\t\t==============================\n"; 301 | cout<<"\t\t\t\t| BANK MANAGEMENT SYSTEM |"; 302 | cout<<"\n\t\t\t\t==============================\n"; 303 | 304 | cout<>ch; 317 | 318 | switch(ch) 319 | { 320 | case '1': 321 | accountDetails(); 322 | break; 323 | case '2': 324 | system("cls"); 325 | cout<<"\n\n\t\t\tEnter The account No. : "; 326 | cin>>num; 327 | deposit_withdraw(num, 1); 328 | break; 329 | case '3': 330 | system("cls"); 331 | cout<<"\n\n\t\t\tEnter The account No. : "; 332 | cin>>num; 333 | deposit_withdraw(num, 2); 334 | break; 335 | case '4': 336 | system("cls"); 337 | cout<<"\n\n\t\t\tEnter The account No. : "; 338 | cin>>num; 339 | display_sp(num); 340 | break; 341 | case '5': 342 | displayRecords(); 343 | break; 344 | case '6': 345 | system("cls"); 346 | cout<<"\n\n\t\t\tEnter The account No. : "; 347 | cin>>num; 348 | deleteAccount(num); 349 | break; 350 | case '7': 351 | system("cls"); 352 | cout<<"\n\n\t\t\tEnter The account No. : "; 353 | cin>>num; 354 | modifyAccount(num); 355 | break; 356 | case '8': 357 | system("cls"); 358 | cout<<"\n\n\t\t\tThank You For Banking With WOI-BANK...."; 359 | break; 360 | default :cout<<"\a"; 361 | } 362 | cin.ignore(); 363 | cin.get(); 364 | }while(ch!='8'); 365 | } 366 | 367 | 368 | int main(){ 369 | 370 | menulist(); 371 | return 0; 372 | } 373 | -------------------------------------------------------------------------------- /OOP PROJECT/PROJECT/customer_end2.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class account{ 11 | int accNo; 12 | char name[50]; 13 | char city[50]; 14 | int deposit,x; 15 | double contact; 16 | double CNIC; 17 | string statius; 18 | char type; 19 | public: 20 | virtual void createAccount(); 21 | virtual void displayAccount() const; 22 | virtual void modify(); 23 | virtual void dep(int); 24 | virtual void draw(int); 25 | virtual void report() const; 26 | virtual int retaccNo() const; 27 | virtual int retdeposit() const; 28 | virtual char rettype() const; 29 | virtual void menulist(); 30 | }; 31 | 32 | 33 | //This FUnction is used to create an Account of User. 34 | int gen_acc_num() 35 | { 36 | static int s_nID = 1; 37 | return s_nID++; 38 | } 39 | void account::createAccount() 40 | { 41 | system("cls"); 42 | cout<>contact; 53 | cout<>CNIC; 56 | cout<>type; 59 | type=toupper(type); 60 | cout<>deposit; 63 | cout<>type; 87 | type=toupper(type); 88 | cout<<"\n\t\t\tModify Balance amount : "; 89 | cin>>deposit; 90 | } 91 | 92 | 93 | void account::dep(int x) 94 | { 95 | deposit+=x; 96 | } 97 | 98 | void account::draw(int x) 99 | { 100 | deposit-=x; 101 | } 102 | 103 | void account::report() const 104 | { 105 | cout< (&ac), sizeof(account)); 132 | outFile.close(); 133 | } 134 | 135 | 136 | void display_sp(int n) 137 | { 138 | account ac; 139 | bool flag=false; 140 | ifstream inFile; 141 | inFile.open("account.dat",ios::binary); 142 | if(!inFile) 143 | { 144 | cout<<"File could not be open !! Press any Key..."; 145 | return; 146 | } 147 | cout<<"\n\t\t\tBALANCE DETAILS\n"; 148 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 149 | { 150 | if(ac.retaccNo()==n) 151 | { 152 | ac.displayAccount(); 153 | flag=true; 154 | } 155 | } 156 | inFile.close(); 157 | if(flag==false){ 158 | cout<<"\n\n\t\t\tAccount number does not exist"; 159 | } 160 | 161 | } 162 | 163 | 164 | 165 | void modifyAccount(int n) 166 | { 167 | bool found=false; 168 | account ac; 169 | fstream File; 170 | File.open("account.dat",ios::binary|ios::in|ios::out); 171 | if(!File) 172 | { 173 | cout<<"File could not be open !! Press any Key..."; 174 | return; 175 | } 176 | while(!File.eof() && found==false) 177 | { 178 | File.read(reinterpret_cast (&ac), sizeof(account)); 179 | if(ac.retaccNo()==n) 180 | { 181 | ac.displayAccount(); 182 | cout<<"\n\n\t\t\tEnter The New Details of account"<(sizeof(account)); 185 | File.seekp(pos,ios::cur); //fncallat1353 186 | File.write(reinterpret_cast (&ac), sizeof(account)); 187 | cout<<"\n\n\t\t\tRecord Updated"; 188 | found=true; 189 | } 190 | } 191 | File.close(); 192 | if(found==false) 193 | cout<<"\n\n\t\t\tRecord Not Found "; 194 | } 195 | 196 | 197 | void deleteAccount(int n) 198 | { 199 | account ac; 200 | ifstream inFile; 201 | ofstream outFile; 202 | inFile.open("account.dat",ios::binary); 203 | if(!inFile) 204 | { 205 | cout<<"File could not be open !! Press any Key..."; 206 | return; 207 | } 208 | outFile.open("Temp.dat",ios::binary); 209 | inFile.seekg(0,ios::beg); 210 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 211 | { 212 | if(ac.retaccNo()!=n) 213 | { 214 | outFile.write(reinterpret_cast (&ac), sizeof(account)); 215 | } 216 | } 217 | inFile.close(); 218 | outFile.close(); 219 | remove("account.dat"); 220 | rename("Temp.dat","account.dat"); 221 | cout<<"\n\n\t\tRecord Deleted .."; 222 | } 223 | 224 | 225 | void displayRecords() 226 | { 227 | system("cls"); 228 | account ac; 229 | ifstream inFile; 230 | inFile.open("account.dat",ios::binary); 231 | if(!inFile) 232 | { 233 | cout<<"File could not be open !! Press any Key..."; 234 | return; 235 | } 236 | cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; 237 | cout<<"====================================================\n"; 238 | cout<<"A/c no. NAME Type Balance\n"; 239 | cout<<"====================================================\n"; 240 | while(inFile.read(reinterpret_cast (&ac), sizeof(account))) 241 | { 242 | ac.report(); 243 | } 244 | inFile.close(); 245 | } 246 | void deposit_withdraw(int n, int option) 247 | { 248 | int amt; 249 | bool found=false; 250 | account ac; 251 | fstream File; 252 | File.open("account.dat", ios::binary|ios::in|ios::out); 253 | if(!File) 254 | { 255 | cout<<"File could not be open !! Press any Key..."; 256 | return; 257 | } 258 | while(!File.eof() && found==false) 259 | { 260 | File.read(reinterpret_cast (&ac), sizeof(account)); 261 | if(ac.retaccNo()==n) 262 | { 263 | ac.displayAccount(); 264 | if(option==1) 265 | { 266 | //cout<<"\n\n\t\t\tTO DEPOSITSS AMOUNT"; 267 | cout<<"\n\n\t\t\tEnter The amount to be deposited: "; 268 | cin>>amt; 269 | ac.dep(amt); 270 | } 271 | if(option==2) 272 | { 273 | //cout<<"\n\n\t\t\tTO WITHDRAW AMOUNT"; 274 | cout<<"\n\n\t\t\tEnter The amount to be withdraw: "; 275 | cin>>amt; 276 | int bal=ac.retdeposit()-amt; 277 | if(bal<0) 278 | cout<<"Sorry !! Insufficience balance.."; 279 | else 280 | ac.draw(amt); 281 | } 282 | int pos=(-1)*static_cast(sizeof(ac)); 283 | File.seekp(pos,ios::cur);//fn1353 284 | File.write(reinterpret_cast (&ac), sizeof(account)); 285 | cout<<"\n\n\t\t\tSuccess... Record Updated Successfully"; 286 | found=true; 287 | } 288 | } 289 | File.close(); 290 | if(found==false) 291 | cout<<"\n\n\t\t\tOops! We Couldn't find your record"; 292 | } 293 | 294 | 295 | // MenuList of Project 296 | 297 | 298 | void menulist(){ 299 | char ch; 300 | int num; 301 | do 302 | { 303 | system("cls"); 304 | cout<<"\n\n\t\t\t\t==============================\n"; 305 | cout<<"\t\t\t\t| BANK MANAGEMENT SYSTEM |"; 306 | cout<<"\n\t\t\t\t==============================\n"; 307 | 308 | cout<>ch; 321 | 322 | switch(ch) 323 | { 324 | case '1': 325 | accountDetails(); 326 | break; 327 | case '2': 328 | system("cls"); 329 | cout<<"\n\n\t\t\tEnter The account No. : "; 330 | cin>>num; 331 | deposit_withdraw(num, 1); 332 | break; 333 | case '3': 334 | system("cls"); 335 | cout<<"\n\n\t\t\tEnter The account No. : "; 336 | cin>>num; 337 | deposit_withdraw(num, 2); 338 | break; 339 | case '4': 340 | system("cls"); 341 | cout<<"\n\n\t\t\tEnter The account No. : "; 342 | cin>>num; 343 | display_sp(num); 344 | break; 345 | case '5': 346 | displayRecords(); 347 | break; 348 | case '6': 349 | system("cls"); 350 | cout<<"\n\n\t\t\tEnter The account No. : "; 351 | cin>>num; 352 | deleteAccount(num); 353 | break; 354 | case '7': 355 | system("cls"); 356 | cout<<"\n\n\t\t\tEnter The account No. : "; 357 | cin>>num; 358 | modifyAccount(num); 359 | break; 360 | case '8': 361 | system("cls"); 362 | cout<<"\n\n\t\t\tThank You For Banking With WOI-BANK...."; 363 | break; 364 | default :cout<<"\a"; 365 | } 366 | cin.ignore(); 367 | cin.get(); 368 | }while(ch!='8'); 369 | } 370 | 371 | int main(){ 372 | account a; 373 | a.menulist(); 374 | } 375 | --------------------------------------------------------------------------------