void dep_with(int e, int f) { int amt; int recordFind=0; account ac; ifstream updatedata("E:\\c++ Project\\final thoughts\\my.dat", ios::in|ios::out); while(updatedata.read((char*) &ac, sizeof(ac)) && recordFind==0) { if(ac.get_account()==e) { ac.view_account(); if(f==1) { cout<<"\nEnter the amount to be deposited"; cin>>amt; ac.deposits(amt); } if(f==2) { cout<<"\nEnter the amount to be withdraw"; cin>>amt; ac.withdrawls(amt); } int pos=(-1)*sizeof(ac); ofstream updatedata("E:\\c++ Project\\final thoughts\\my.dat", ios::in|ios::out|ios::app); updatedata.seekp(pos,ios::cur); updatedata.write((char*) &ac, sizeof(ac)); cout<<"\n\n\tRecord Updated"; recordFind=1; } } updatedata.close(); if(recordFind==0) { cout<<"\n\nRecord not Found"; } }
updatedata
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)