You are on page 1of 30

.TOPIC

.CERTIFICATE
.ACKNOWLWDGEMENT
.INTRODUCTION ABOUT TOPIC
.AIM AND OBJECTIVE
.CODING
.SCREENSHOTS

This is to certify that ‘Prashant Rai
Saxena’ of class ‘XII A’ has made a
project titled ‘GK QUIZ’ under my
supervision and guidance.
The work speaks about the efforts of
the student & think quite satisfactory
and should be kept for evaluation
Teacher
MISS MENKA

I gratefully thanks MISS MENKA
SINGH PGT(COMPUTER
SCIENCE)for the support she has
given me to undertake this
interesting project and help she
has given me for the successful
completion of this project I
gratefully appreciate all the
cooperation guidance & expert
inputs provided by her
During my project.

h> #include <stdio. int last_accno(void) . void delete_account(int) .h> #include <dos. } . private : void edit_menu(void) .h> #include <ctype.h> #include <process. void update_balance(int. .h> #include <conio. char *return_address(int) . void display_list(void) . void modify(void) . float) . float) . char *return_name(int) . void help(void) .h> #include <stdlib.h> #include <fstream.h> #include <string.h> //********************************************************** // THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU //********************************************************** class control { public : void main_menu(void) . //********************************************************** // THIS CLASS CONTAINS FUNCTIONS RELATED TO INITIAL DEPOSIT //********************************************************** class initial { public : void add_to_file(int. int found_account(int) . char t_address[60].SOURCE CODE //********************************************************** // PROJECT BANKING //********************************************************** //********************************************************** // INCLUDED HEADER FILES //********************************************************** #include <iostream. char t_name[30].

void box_for_list(void) . // Date // char tran . } . void close_account(void) . //********************************************************** // THIS CLASS CONTAINS FUNCTIONS RELATED TO TRANSACTIONS //********************************************************** class account { public : void new_account(void) . float give_balance(int) . float) . int no_of_days(int. void box_for_display(int) .9) . while (1) { clrscr() . int accno . gotoxy(35. private : void add_to_file(int. int accno . // Deposit or Withdraw // float interest. amount. // Cheque or Cash // int dd. char type[10] . void display(int) . void display_account(void) . int. . void clear(int. void transaction(void) . char t_name[30]. address[60] . yy . //********************************************************** // FUNCTION TO DISPLAY MAIN MENU AND CALL OTHER FUNCTIONS //********************************************************** void control :: main_menu(void) { char ch . char t_address[60]) . float. void display(int) . float. } . int) . char name[30]. float calculate_interest(int. gotoxy(32. balance . int. float balance .7) . mm. char. private : void modify_account(int. int. int. int.int) . char t_type[10]. int. int. void delete_account(int) . float) .

cout <<"4: OPEN NEW ACCOUNT" . } else if (ch == '2') { initial ini . if (ch == 27) break .19) .11) .14) . cout <<"1: SEE ACCOUNT" . } else if (ch == '4') { account a .13) . cout <<"5: EDIT ACCOUNTS" . a. gotoxy(30. else if (ch == '1') { account a . ini. gotoxy(30. cout <<"2: LIST OF ACCOUNTS" . gotoxy(30.12) .16) . else .15) .new_account() .17) . gotoxy(30. gotoxy(30. gotoxy(30.cout<<"OPTIONS". cout <<"3: TRANSACTIONS" . a.transaction() . a. gotoxy(30. } else if (ch == '5') edit_menu() . gotoxy(30. cout <<"6: HELP" .display_list() . cout <<"Enter your choice: " .display_account() . ch = getch() . cout <<"0: QUIT" . } else if (ch == '3') { account a .

if (ch == '6') help() .close_account() . gotoxy(31. . gotoxy(31. gotoxy(31.16) . else if (ch == '1') { initial ini . while (1) { clrscr() . else if (ch == '0') break . cout<<" EDIT MENU " . cout <<"0: QUIT" .10) .14) . } } //********************************************************** // FUNCTION TO DISPLAY EDIT MENU AND CALL OTHER FUNCTIONS //********************************************************** void control :: edit_menu(void) { char ch .13) . cout <<"1: MODIFY ACCOUNT" . a. break . } else if (ch == '2') { account a . cout <<"Enter your choice: " . ch = getch() . ini.12) . cout <<"2: CLOSE ACCOUNT" . gotoxy(34. break . } else if (ch == '0') break . gotoxy(31. if (ch == 27) break .modify() .

17). delay(10) .} } //********************************************************** // FUNCTION TO DISPLAY HELP ABOUT PROJECT //********************************************************** void control :: help(void) { clrscr() . cout<<"WELCOME TO PROJECT BANKING". delay(10) . delay(10) . gotoxy(10. cout <<" person by giving simply account no. delay(10) ." .Through third option you can do banking transactions" . gotoxy(10. delay(10) .500/-" . cout <<" (NOTE: Opening amount should not less than Rs. delay(10) ." .7).19).6). cout <<"transactions. cout <<" This program is capable of holding any no of account. gotoxy(10." .11).20). gotoxy(10.3). cout <<". . " . delay(10) .In second option you can see the list of all the accounts. gotoxy(10. delay(10) .In first option you can see the account of a particular". gotoxy(10. cout <<"In this Project you can keep record of daily banking" . gotoxy(10.9).16)." . gotoxy(10. gotoxy(10. cout <<" (Deposit/Withdraw). cout <<"." . gotoxy(27. gotoxy(10. of that person. delay(10) .In Fourth option you can open new account.14). cout <<".12). cout <<".

gotoxy(26. if (t_accno == accno) break .22).close() .ios::beg) . } //********************************************************** // THIS FUNCTION RETURN RECORD NO. ios::in) .open("INITIAL.DAT".seekg(0." . int count=0 . file. ios::in) . file. " . cout <<". delay(10) . cout <<". getch() . file. while (file. return count . gotoxy(10. delay(10) .25) . sizeof(initial))) count = accno . return count . gotoxy(10. file.In Fifth option you can modify or Delete any account. } .2) . } //********************************************************** // THIS FUNCTION RETURN LAST ACCOUNT NO.DAT //********************************************************** int initial :: recordno(int t_accno) { fstream file . } file. sizeof(initial))) { count++ .open("INITIAL. IN THE FILE // INITIAL.seekg(0. while (file.And last option is Quit (Exit to Dos). delay(10) .ios::beg) .close() . file. int count=0 .24).read((char *) this.DAT". gotoxy(25. OF THE GIVEN ACCOUNT NO. cout<<" Press any key to continue ". // IN THE FILE INITIAL.read((char *) this.DAT //********************************************************** int initial :: last_accno(void) { fstream file .

ios::in) .9) . sizeof(initial))) { if (t_accno == accno) { gotoxy(8. char t_name[30] .open("INITIAL. cout <<"Name : " <<name . cout <<"Balance : " <<balance .5) . file.ios::beg) .//********************************************************** // THIS FUNCTION DISPLAY THE ACCOUNT FOR GIVEN ACCOUNT NO. break . return t_name . file. // FROM THE FILE INITIAL.close() . } . gotoxy(10.open("INITIAL. " <<accno .read((char *) this.DAT".ios::beg) . } //********************************************************** // THIS FUNCTION RETURN NAME FOR THE GIVEN ACCOUNT NO. sizeof(initial))) { if (accno == t_accno) { strcpy(t_name. file.10) .DAT //********************************************************** void initial :: display(int t_accno) { fstream file .8) .seekg(0. break .DAT //********************************************************** char *initial :: return_name(int t_accno) { fstream file . while (file. while (file. } } file. file. cout <<"Address : " <<address . cout <<"ACCOUNT NO. // IN THE FILE INITIAL.read((char *) this.close() . gotoxy(10.DAT".seekg(0.name) . gotoxy(10. } } file. ios::in) .

//********************************************************** // THIS FUNCTION RETURN ADDRESS FOR THE GIVEN ACCOUNT NO. while (file. ios::in) .ios::beg) .open("INITIAL.ios::beg) . sizeof(initial))) { if (accno == t_accno) { strcpy(t_address. file.seekg(0. break . while (file. float t_balance .seekg(0.address) . break .open("INITIAL.DAT".read((char *) this. // IN THE FILE INITIAL.DAT".close() .read((char *) this.close() .DAT //********************************************************** float initial :: give_balance(int t_accno) { fstream file . sizeof(initial))) { if (accno == t_accno) { t_balance = balance . } //********************************************************** // THIS FUNCTION RETURN BALANCE FOR THE GIVEN ACCOUNT NO. } } file. return t_address . file. FOUND // IN THE FILE INITIAL. } //********************************************************** // THIS FUNCTION RETURN 1 IF THE GIVEN ACCOUNT NO. ios::in) .DAT //********************************************************** int initial :: found_account(int t_accno) { . file. return t_balance . file. char t_address[60] . } } file.DAT //********************************************************** char *initial :: return_address(int t_accno) { fstream file . // IN THE FILE INITIAL.

DAT". fstream file .close() . gotoxy(4. getdate(&d).da_year . ios::in) . d1 = d. flag .open("INITIAL.read((char *) this. ios::in) .read((char *) this.open("INITIAL.2) .DAT //********************************************************** void initial :: display_list(void) { clrscr() . int row=6. m1 = d. sizeof(initial))) { if (accno == t_accno) { found = 1 .4) . int d1.da_day . cout <<"Date: " <<d1 <<"/" <<m1 <<"/" <<y1 . for (int i=1. file.da_mon .seekg(0. gotoxy(4. break . file. i<=76. } } file.ios::beg) .DAT". while (file. cout<<"ACCOUNT NO. while (file. int found=0 . i++) cout<<" " . } //********************************************************** // THIS FUNCTION DRAWS THE BOX FOR THE LIST OF ACCOUNTS //********************************************************** void initial :: box_for_list() { gotoxy(3. } //********************************************************** // THIS FUNCTION DISPLAYS THE LIST OF ACCOUNTS IN FILE // INITIAL. return found . NAME OF PERSON BALANCE" . sizeof(initial))) { . y1 . m1. box_for_list() . fstream file . file. struct date d. y1 = d.4) .

. // FROM THE FILE INITIAL.row) .DAT //********************************************************** void initial :: add_to_file(int t_accno. gotoxy(57.open("INITIAL.t_name) . cout <<name .t_address) . file.write((char *) this. cout <<"Press any key to continue. char t_address[60]. if (!flag) { gotoxy(4. flag = 0 . float t_balance) { accno = t_accno . gotoxy(4. strcpy(address. cout <<accno . strcpy(name. delay(10) . file. } //********************************************************** // THIS FUNCTION DELETES RECORD FOR THE GIVEN ACOUNT NO. fstream file . getch() .. row = 6 .24) . box_for_list() . gotoxy(25.24) .close() . sizeof(initial)) .. cout <<"Press any key to continue.row) .close() .. if (row == 23) { flag = 1 . balance = t_balance ." . gotoxy(7. row++ . cout <<balance . clrscr() . getch() ." . ios::out | ios::app) .DAT". } } //********************************************************** // THIS FUNCTION ADDS THE GIVEN DATA INTO THE FILE // INITIAL. } } file. char t_name[30].row) .DAT //********************************************************** void initial :: delete_account(int t_accno) { . file.

// IN THE FILE INITIAL. file.seekp(location) . if ( temp.eof() ) break . } file. recno = recordno(t_accno) . int location .DAT". if ( accno != t_accno ) temp.write((char *) this.DAT //********************************************************** void initial :: update_balance(int t_accno. float t_balance) { int recno . ios::out) .dat". sizeof(initial)) .close() .seekg(0.DAT".ios::beg) .write((char *) this.close() .open("INITIAL. file.close() .close() . temp. temp. ios::out) .open("INITIAL. temp.close() . fstream file . while ( !temp. if ( file. ios::in) . sizeof(initial)) . sizeof(initial)) .write((char *) this.DAT //********************************************************** . } //********************************************************** // THIS FUNCTION MODIFIES THE RECORD FOR THE GIVEN DATA // IN THE FILE INITIAL.eof() ) { temp. ios::in) .read((char *) this.eof() ) break . while ( !file. fstream temp . file.ios::beg) . file. ios::out | ios::ate) . } file. fstream file . } //********************************************************** // THIS FUNCTION UPDATE BALANCE FOR THE GIVEN ACOUNT NO. temp.open("temp. file. file. location = (recno-1) * sizeof(initial) . file.DAT".open("temp. file.dat". temp.eof() ) { file. sizeof(initial)) . balance = t_balance .read((char *) this.seekg(0.open("INITIAL. sizeof(initial)) .

int location . file. (WHITE) . return . clrscr() . getch() . ios::out | ios::ate) . char t_acc[10] .3) . gotoxy(3. cout <<"\7Account not found" . gotoxy(71. sizeof(initial)) . ( WHITE) . (LIGHTGRAY) . } gotoxy(71. t_accno = t . char t_address[60]) { int recno . file.3) .close() . recno = recordno(t_accno) . (BLACK+BLINK) . strcpy(address. i++) cout<<" " .5) . file. cout <<"Enter the account no.5) . cout <<"<0>=Exit" .seekp(location) . location = (recno-1) * sizeof(initial) . t = atoi(t_acc) . gotoxy(30. char t_name[30].t_address) . int t.DAT". cout<<"MODIFY ACCOUNT SCREEN" . cout <<"<0>=Exit" . for (int i=1. " .void initial :: modify_account(int t_accno. t_accno . . } //********************************************************** // THIS FUNCTION GIVE THE DATA TO MODIFY THE RECORD IN THE // FILE INITIAL. (BLACK) . gotoxy(5.write((char *) this. strcpy(name. (BLACK) .1) .t_name) .1) . file. fstream file .DAT //********************************************************** void initial :: modify(void) { clrscr() . if (t_accno == 0) return . i<=76.open("INITIAL. if (!found_account(t_accno)) { gotoxy(5. gets(t_acc) .

cout <<"Name : " .da_day . gotoxy(5. gotoxy(5.16) .16) . cout <<"ENTER NAME or PRESS <ENTER> FOR NO CHANGE" . if (strlen(t_name) > 25) { valid = 0 .da_mon .13) . m1. int modified=0.23) . cout<<"\7NAME SHOULD NOT GREATER THAN 25" .int d1. . gotoxy(5. do { a. do { a.da_year . account a .clear(5. char ch . gotoxy(62.13) . a. gotoxy(5. char t_name[30]. strupr(t_name) .15) .5) .15) . valid = 1 . do { a.15) . gets(t_name) . if (t_name[0] == '0') return .clear(5. getdate(&d). t_address[60] . ch = toupper(ch) . getch() .23) . gotoxy(15. struct date d.23) . y1 . if (ch == '0') return . d1 = d.clear(5. display(t_accno) . cout <<"Modify this account (y/n): " . } } while (!valid) . } while (ch != 'N' && ch != 'Y') . if (ch == 'N') return . cout <<"Date: "<<d1 <<"/" <<m1 <<"/" <<y1 . gotoxy(5. valid . if (strlen(t_name) > 0) modified = 1 . a.clear(15. gotoxy(5.23) . m1 = d.23) . cout <<"Address : " .clear(15. y1 = d. ch = getche() .

. ch = getche() .16) . gotoxy(5.23) . gotoxy(5. gets(t_address) . cout <<"Press any key to continue. if (strlen(t_address) > 55) { valid = 0 . strupr(t_address) . ch = toupper(ch) .t_address) . } while (ch != 'N' && ch != 'Y') .clear(5. a. do { a.18) . cout <<" " . gotoxy(5. gotoxy(15. modify_account(t_accno. i++) { gotoxy(i.18) . i<=78. valid = 1 ." . if (ch == '0') return . if (!modified) return . cout <<"\7Record Modified" . cout<<"\7SHOULD NOT BLANK OR GREATER THAN 55" . gotoxy(5.t_name.row) . } //********************************************************** // THIS FUNCTION CLEAR THE GIVEN ROW AND COLUMNS //********************************************************** void account :: clear(int col.23) . } } while (!valid) . int row) { for (int i=col.23) . } } //********************************************************** . if (ch == 'N') return . if (t_address[0] == '0') return ..clear(5. getch() . cout <<"ENTER ADDRESS or PRESS <ENTER> FOR NO CHANGE" . if (strlen(t_address) > 0) modified = 1 . getch() .21) . cout <<"Do you want to save changes (y/n): " .

seekg(0.DAT". temp. temp. ios::out) . } //********************************************************** // THIS FUNCTION DELETES THE RECORD FOR GIVIN ACCOUNT NO. balance = t_balance . float t_balance) { fstream file . file.read((char *) this.DAT". amount = t_amount . interest = t_interest . int y1. temp. file. sizeof(account)) . if ( file.close() . float t_amount. yy = y1 . if ( temp. file. file. char t_type[10].open("temp.open("temp. // FROM FILE BANKING. while ( !file.write((char *) this.eof() ) break . tran = t_tran . ios::in) .open("BANKING.close() .DAT //********************************************************** void account :: add_to_file(int t_accno. } file.close() . strcpy(type. sizeof(account)) .read((char *) this.open("BANKING.ios::beg) . char t_tran. int m1. file.t_type) . int d1.seekg(0. dd = d1 .dat". ios::app) .open("BANKING.write((char *) this. while ( !temp.dat". accno = t_accno . temp. ios::in) .// THIS FUNCTION ADDS THE GIVEN DATA INTO THE FILE // BANKING. sizeof(account)) . file.DAT //********************************************************** void account :: delete_account(int t_accno) { fstream file . .eof() ) { file.eof() ) break . ios::out) . } file.DAT". sizeof(account)) . file. float t_interest.ios::beg) . fstream temp . if ( accno != t_accno ) temp.write((char *) this. sizeof(account)) .eof() ) { temp. mm = m1 .close() .

# " <<t_accno .1. gotoxy(3. (LIGHTGRAY) .'D'.1) . if (t_accno == 1) { ini. gotoxy(5.6) . y1 = d.1."xyz".1. t_address[60] . clrscr() . temp.1.1997.10) . for (i=1. i++) cout<<" " .1. } char t_name[30]. (BLACK+BLINK) .last_accno() . m1. cout <<"Date : "<<d1 <<"/" <<m1 <<"/" <<y1 .1) .11) .1.da_day .add_to_file(t_accno.da_year .1) .da_mon .close() .3) . gotoxy(5.1. gotoxy(5.3) . int i.1. t_balance=0. (WHITE) . initial ini . m1 = d. . gotoxy(32. (BLACK) . int t_accno . gotoxy(5. add_to_file(t_accno. t[10]."INITIAL". struct date d. float t_bal=0. cout <<"Account no. cout <<"Address : " . cout <<"<0>=Exit" . cout<<"OPEN NEW ACCOUNT" . getdate(&d). gotoxy(71.DAT //********************************************************** void account :: new_account(void) { char ch . t_accno = ini.12) . t_accno++ . y1 .8) . (WHITE) . gotoxy(5. ini.0 . d1 = d.0. i<=76. (BLACK) . } //********************************************************** // THIS FUNCTION ACCEPTS THE DATA TO ADD RECORDS IN THE // FILE BANKING."abc". cout <<"Name : " .delete_account(t_accno) . delete_account(t_accno) . int d1. valid .

if (t_address[0] == '0') return . if (t_name[0] == '0') return . cout<<"\7SHOULD NOT BLANK OR GREATER THAN 55" . do { clear(15. clear(5. } } while (!valid) . gotoxy(5.11) . valid = 1 . gotoxy(5. cout<<"\7NAME SHOULD NOT BLANK OR GREATER THAN 25" . clear(5. strupr(vari) . do { char vari[30] .23) . valid = 1 .12) . gotoxy(5. cout <<"ENTER ADDRESS OF THE PERSON" . valid = 1 . strupr(t_name) . gotoxy(5.11) . gotoxy(5.23) . gets(t_address) .10) . clear(5. cout <<"ENTER NAME OF THE PERSON" .23) .23) .23) . clear(31. gotoxy(5. gotoxy(31. gets(t_name) .12) . cout <<"Initial Deposit : " .10) . if (strlen(t_address) == 0 || strlen(t_address) > 55) { valid = 0 .23) . } } while (!valid) .23) . gotoxy(15. cout <<"ENTER NAME OF THE VARIFING PERSON" . . do { clear(15. getch() . strupr(t_address) .14) . if (strlen(t_name) == 0 || strlen(t_name) > 25) { valid = 0 . gets(vari) .23) .cout <<"Name of Varifing person : " . getch() . gotoxy(15. if (vari[0] == '0') return .

if (t_balance < 500) { valid = 0 . ch = getche() .23) .add_to_file(t_accno.17) . cout <<"ENTER INITIAL AMOUNT TO BE DEPOSIT" . add_to_file(t_accno. ch = toupper(ch) . t_interest = 0.t_balance) .t_name. cout<<"\7SHOULD NOT BLANK OR GREATER THAN 25" . } while (ch != 'N' && ch != 'Y') ."INITIAL") . valid = 1 .d1. cout<<"\7SHOULD NOT LESS THAN 500 " . if (t[0] == '0') return .0 .y1. clear(5. t_interest .t_amount. } //********************************************************** . } } while (!valid) .14) . cout <<"Do you want to save the record (y/n) : " . t_tran = 'D' . t_balance = t_bal . char t_tran. } } while (!valid) .t_address. clear(5.t_interest. do { clear(5.23) . gotoxy(23. do { clear(23. gotoxy(5.23) . if (strlen(vari) == 0 || strlen(vari) > 25) { valid = 0 . getch() .23) . gotoxy(5. if (ch == '0') return . t_bal = atof(t) .t_tran.17) .14) . ini. gotoxy(5. gets(t) . t_type[10] .t_balance ) . t_amount = t_balance . float t_amount.t_type. valid = 1 . getch() . gotoxy(5.23) . strcpy(t_type.m1. if (ch == 'N') return .

gotoxy(25. cout <<t_address . gotoxy(63. int d1.da_mon . t_accno . cout <<"Date: " <<d1 <<"/" <<m1 <<"/" <<y1 .5) .3) . (BLACK) . getdate(&d). char t_address[60] . char t_acc[10] .2) . int t. gotoxy(71. y1 = d. cout <<"<0>=Exit" . t = atoi(t_acc) . if (!ini.ini. m1 = d. initial ini . t_accno = t .return_address(t_accno)) . strcpy(t_address.da_day .1) . cout <<t_name . if (t_accno == 0) return . cout<<"DATE PARTICULAR DEPOSIT WITHDRAW INTEREST BALANCE" . " . struct date d.found_account(t_accno)) .DAT //********************************************************** void account :: box_for_display(int t_accno) { gotoxy(3. i<=76.5) . initial ini .5) . (LIGHTGRAY) . y1 . d1 = d. gotoxy(25. " <<t_accno . for (int i=1.DAT //********************************************************** void account :: display_account(void) { clrscr() . gotoxy(4. cout <<"Account no. cout <<"Enter the account no. } //********************************************************** // THIS FUNCTION DISPLAY RECORD FROM THE FILE BANKING. m1.da_year . i++) cout<<" " .ini. gets(t_acc) . clrscr() . strcpy(t_name. char t_name[30] .// THIS FUNCTION DRAWS THE BOX FOR DISPLAYING RECORD FROM // FILE BANKING.2) .2) .return_name(t_accno)) . gotoxy(5. gotoxy(4.

} } //********************************************************** // THIS FUNCTION RETURNS THE DIFFERENCE BETWEEN 2 DATES. delay(10) ... ios::in) .DAT". while (file. cout <<"Press any key to continue. clrscr() .5) . gotoxy(16.24) . gotoxy(56. cout <<"\7Account not found" . if (!flag) { gotoxy(4. cout <<amount . getch() . cout <<balance . cout <<type . getch() . fstream file .close() .read((char *) this." ." .open("BANKING. //********************************************************** . else gotoxy(42. { gotoxy(5..24) ..row) . gotoxy(4. gotoxy(4.row) . int row=7. cout <<"Press any key to continue. if (row == 23) { flag = 1 . getch() . row++ . file. box_for_display(t_accno) . row = 7 .row) . return . } box_for_display(t_accno) . if (tran == 'D') gotoxy(30.row) .row) . cout <<dd <<"/" <<mm <<"/" <<yy .row) . gotoxy(66. cout <<interest . sizeof(account))) { if (accno == t_accno) { flag = 0 . flag . } } } file.

if ((y2<y1) || (y2==y1 && m2<m1) || (y2==y1 && m2==m1 && d2<d1)) return t_interest .31. } //********************************************************** // THIS FUNCTION CALCULATES INTEREST. y1++ . int m1. file.31} . days = no_of_days(d1. m1++ . y2 = d. m1. int y1. y1.m2. int m2.ios::beg) . //********************************************************** float account :: calculate_interest(int t_accno.da_year .30. getdate(&d). days .0 . ios::in) . float t_balance) { fstream file . d1++ . if (d1 > month[m1-1]) { d1 = 1 .open("BANKING. while (d1 != d2 || m1 != m2 || y1 != y2) { days++ .31. file. } } int d2. d2 = d.30.da_day .seekg(0.DAT".31. break . } if (m1 > 12) { m1 = 1 .30. int months=0 .da_mon . y2 . if (days >= 30) { .d2.y2) . float t_interest=0.int account :: no_of_days(int d1. struct date d.y1.31. sizeof(account))) { if (accno == t_accno) { d1 = dd .30. m2 = d. } } return days .28. int d2. int days = 0 .31.read((char *) this.m1. y1 = yy . int d1. m2. while (file. m1 = mm . int y2) { static int month[] = {31.

5) . t_accno. t_interest = ((t_balance*2)/100) * months . } //********************************************************** // THIS FUNCTION MAKES TRANSACTIONS (DEPOSIT/WITHDRAW).da_year . gotoxy(5. m1. cout <<"Date : "<<d1 <<"/" <<m1 <<"/" <<y1 .3) . initial ini . //********************************************************** void account :: transaction(void) { clrscr() . months = days/30 .close() . d1 = d. char t_acc[10] . cout<<"TRANSACTION IN ACCOUNT" .da_day . int t. cout <<"Enter the account no. cout <<"\7Account not found" . int d1. . t = atoi(t_acc) . gotoxy(3. i++) cout<<" " . # " <<t_accno . m1 = d. cout <<"<0>=Exit" . gotoxy(71. if (!ini. clrscr() .1) . i<=76.da_mon . gotoxy(5. cout <<"Account no. gotoxy(29. return t_interest .3) .found_account(t_accno)) { gotoxy(5. getdate(&d). t_accno = t . " . valid . } file. if (t_accno == 0) return . getch() . struct date d.6) . for (int i=1. return . gotoxy(5.5) .8) . } gotoxy(71.1) . y1 . gets(t_acc) . y1 = d. cout <<"<0>=Exit" .

gotoxy(5."CHEQUE")) { valid = 0 .11) .23) . gotoxy(5.21) . t_tran = toupper(t_tran) .23) . clear(5. cout <<"ENTER TRANSACTION BY CASH OR CHEQUE" . cout <<"ENTER AMOUNT FOR TRANSACTION" . cout <<"Amount : Rs. if (t_tran == '0') return . t_amt . cout <<"Deposit or Withdraw (D/W) : " ." <<t_balance . gets(t_type) . cout <<"(Cash/Cheque) : " .give_balance(t_accno) . gotoxy(5. valid = 1 . . gotoxy(27.15) . valid = 1 . gotoxy(5.21) .return_address(t_accno)) . gotoxy(5. t_type[10]. cout<<"\7ENTER CORRECTLY " . do { clear(5. char t_tran. cout <<"Name : " <<t_name .return_name(t_accno)) ." . do { clear(5. } } while (!valid) . } while (t_tran != 'D' && t_tran != 'W') . if (t_type[0] == '0') return . strcpy(t_name. tm[10] . strupr(t_type) . if (strcmp(t_type.18) .23) . strcpy(t_address.ini. valid = 1 . char t_address[60] .19) . do { gotoxy(5. t_tran = getche() .ini.char t_name[30] . float t_amount. t_balance = ini. gotoxy(5.12) . gotoxy(27.23) . float t_balance . cout <<"Address: " <<t_address . getch() ."CASH") && strcmp(t_type. cout <<"Last Balance : Rs.18) .

do { clear(40. getch() .t_balance) . cout<<"\7INVALID DATA ENTERED " . cout <<"Enter the account no. gets(t_acc) .t_type. ini. cout <<"Save transaction (y/n): " .update_balance(t_accno. " . add_to_file(t_accno. t = atoi(t_acc) . t_amount = t_amt . ch = getche() .t_tran. if ((t_tran == 'W' && t_amount > t_balance) || (t_amount < 1)) { valid = 0 . gets(tm) . gotoxy(5.20) . if (ch == 'N') return .t_amount) + t_interest .t_amount. } while (ch != 'N' && ch != 'Y') . int t.5) . t_accno . if (tm[0] == '0') return .t_balance ) . clear(5. float t_interest . if (ch == '0') return . t_interest = calculate_interest(t_accno. valid = 1 . gotoxy(5. if (t_tran == 'D') t_balance = t_balance + t_amount + t_interest . else t_balance = (t_balance . char ch . .m1. } //********************************************************** // THIS FUNCTION CLOSE THE ACCOUNT (DELETE ACCOUNT).t_interest. cout <<"<0>=Exit" . ch = toupper(ch) . //********************************************************** void account :: close_account(void) { clrscr() .1) .t_balance) . } } while (!valid) . gotoxy(40.23) .d1. char t_acc[10] .y1. t_amt = atof(tm) . gotoxy(71. t_accno = t .20) .23) .

m1 = d. clrscr() . delete_account(t_accno) ." . i++) cout<<" " . ch = getche() . ch = toupper(ch) . int d1. } while (ch != 'N' && ch != 'Y') ..da_mon . if (ch == 'N') return .5) . do { gotoxy(5. cout <<"Press any key to continue. gotoxy(3. gotoxy(30. if (t_accno == 0) return .delete_account(t_accno) .3) . ini. gotoxy(5. } gotoxy(71. for (int i=1. cout <<"<0>=Exit" .20) .da_year .da_day . getch() . cout <<"Close this account (y/n): " .1) . cout<<"CLOSE ACCOUNT SCREEN" . initial ini . getdate(&d).found_account(t_accno)) { gotoxy(5. cout <<"Date: "<<d1 <<"/" <<m1 <<"/" <<y1 . m1. y1 = d. y1 . cout <<"\7Record Deleted" .3) .. return . struct date d. if (!ini.5) . gotoxy(5. gotoxy(62. if (ch == '0') return . ini. char ch . } //************************************************************ // THIS IS MAIN FUNCTION CALLING HELP AND MAIN MENU FUNCTIONS //************************************************************ void main(void) .15) .23) . i<=76. d1 = d. cout <<"\7Account not found" .display(t_accno) . getch() .

c.digitalivisionslab. } C++ By Sumita Arora Class-XII (Computer Science) 1.com .{ control c .help() .www.icbse. c.main_menu() .com 2.www.