// bakers.cpp : Defines the entry point for the console application.
//
/* HEADER USED IN THIS PROJECT*/
#include "stdafx.h"
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<string>
#include<stdio.h>
#include<process.h>
#include<fstream>
#include<ctype.h>
using namespace std;
//Classes in this program
class Bank {
private :
long Ac_no;
string f_name , l_name ,City;
char Ac_type;
float deposit, withdraw;
public :
void CreatNew_Account();
void Recreat_Account();
void RemoveAccount();
void ModifyAccount();
void Cardit();
void Debit();
void Bal_Inquiry();
void ShowAcc_Detail();
void bal_inquriy();
void Transection_of_Accounts();
long ret_AccNO()
{
return Ac_no;
}
void dep(int x)
{
deposit+=x;
}
void draw(int x)
{
deposit-=x;
}
/*void ret_type(){
return Ac_type();
}*/
void report()
{cout<<Ac_no<<"\t"<<f_name<<l_name<<"\t\t"<<Ac_type<<"\t\t"<<deposit<<endl;}
};
Bank b;
fstream fp;
void Bank ::CreatNew_Account(){
fp.open("Account.dat",ios::in |ios::app);
//b.CreatNew_Account();
cout<<"\nEnter The account No.";
cin>>Ac_no;
cout<<"\nEnter The Name of The account Holder First name :- ";
cin>>f_name;
cout<<"\nEnter The Name of The account Holder First name :- ";
cin>>l_name;
cout<<"\nEnter Type of The account (C/S) ";
cin>>Ac_type;
Ac_type=toupper(Ac_type);//for upper case
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) :- ";
cin>>deposit;
fp.write((char*)&b,sizeof(Bank));
fp.close();
}
void Bank::Recreat_Account(){
cout<<"\nEnter The Name of The account Holder First name :- ";
cin>>f_name;
cout<<"\nEnter The Name of The account Holder First name :- ";
cin>>l_name;
cout<<"\nEnter Type of The account (C/S) ";
cin>>Ac_type;
Ac_type=toupper(Ac_type);//for upper case
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) :- ";
cin>>deposit;
}
void Bank::ShowAcc_Detail(){
cout<<"\n\n\n WLx Account holder Deatail ";
cout<<"\nAccount No. : "<<Ac_no;
cout<<"\nAccount Holder Name : "<<f_name<<" "<<l_name;
cout<<"\nType of Account : "<<Ac_type;
cout<<"\nBalance amount : "<<deposit;
}
void Bank::bal_inquriy(){
cout<<"\n............Wlx Balance Inqury Menu........."<<endl;
int Acno;
int flag=0;
cout<<"Enter the Account no :- ";
cin>>Acno;
fp.open("Account.dat",ios::in|ios::out);
while(fp.read((char*)&b,sizeof(Bank)))
{
if(Acno==b.ret_AccNO()){
cout<<"\nBALANCE DETAILS\n";
b.ShowAcc_Detail();
flag=1;
}
}
fp.close();
getch();
if(flag==0){
cout<<"\n\nAccount number does not exist plz contect to ur system Administrator";
}
}
void Bank::ModifyAccount(){
cout<<"\n\n\n WLx Modify_Account ";
int Acno;
cout<<"\n\nEnter your Accont no:- ";
cin>>Acno;
int found=0;
fp.open("Account.dat",ios::in|ios::out);
while((fp.read((char*)&b,sizeof(Bank)) && found==0))
if(Acno==b.ret_AccNO()){
b.ShowAcc_Detail();
cout<<"\n\n\n.........New Detail......."<<endl;
b.Recreat_Account();
int pos=-1*sizeof(b);
fp.seekp(pos,ios::cur);
fp.write((char*)&b,sizeof(Bank));
cout<<"\n\n\t Record Updated";
found=1;
fp.close();
//getch();//may be
}
if (found==0){
cout<<"No result fount plx contect to system administrator";
}
getch();
system("cls");
}
/*void Bank::Transection_of_Accounts(){
int Acno;
int flag=0;
cout<<"Enter the Account No : - ";
cin>>Acno;
fp.open("Account.dat",ios::in|ios::out);
while(fp.read((char*)&b,sizeof(Bank)))
{
if(Acno==b.ret_AccNO()){
cout<<"\n* Transection *\n";
b.ShowAcc_Detail();
float Trnf_Rs;
cout<<"Enter the money that you want to Tranfred :- ";
cin>>Trnf_Rs;
b.deposit = b.deposit + Trnf_Rs;
int pos=-1*sizeof(b);
fp.seekp(pos,ios::cur);
fp.write((char*)&b,sizeof(Bank));
cout<<"\n\n\t Record Updated";
flag=1;
}
}
fp.close();
getch();
if(flag==0){
cout<<"\n\nAccount number does not exist plz contect to ur system Administrator";
}
}
*/
int main(){
int no;
Bank B;
cout<<"\nEnter 1 for creatNewAccount ";
cout<<"\nEnter 2 for Modify_Account ";
cout<<"\nEnter 3 for For Balance Iquiry ";
cout<<"\nEnter 4 for For Modifying Accounts ";
cout<<"\nEnter 5 for Transection of Money ";
cout<<"\n\n\n\Presss any key continue...";
getch();
cout<<"\n\n\n\nEnter your choise ";
cin>>no;
switch(no){
case 1:
b.CreatNew_Account();
//creatAccount();
getch();
system("cls");
break;
case 2:
//b.ModifyAccount();
getch();
system("cls");
break;
case 3:
b.bal_inquriy();
getch();
system("cls");
break;
case 4:
b.ModifyAccount();
getch();
system("cls");
break;
case 5:
b.Transection_of_Accounts();
getch();
system("cls");
break;
}
return 0;
getch();
}
Any one can tel me the logic of Transaction of Money from one account to Another Account