fork download
  1. #include<iostream.h>
  2. #include<fstream.h>
  3. #include<process.h>
  4. #include<string.h>
  5. #include<stdio.h>
  6. #include<ctype.h>
  7. #include<conio.h>
  8. #include<dos.h>
  9. #include<stdlib.h>
  10. #include<iomanip.h>
  11. #include<graphics.h>
  12. typedef char option[15];
  13. const int ROW = 10,COL = 10;
  14. int scan;
  15. int ascii;
  16. option a[]= {
  17. "NewAccount",
  18. "ListofAccounts",
  19. "IndAccount",
  20. "Daily Trans",
  21. "MonthlyReport",
  22. "EditAccount",
  23. "Exit"};
  24. option b[] = {
  25. "Modify Account",
  26. "Closeaccount",
  27. "Quit"
  28. };
  29. class main_menu
  30. {
  31. int i,done;
  32. public:
  33. void normalvideo(int x, int y,char *str);
  34. void reversevideo(int x, int y,char *str);
  35. void box(int x1,int y1,int x2,int y2);
  36. char menu();
  37. void control_menu();
  38. char e_menu();
  39. void edit_menu();
  40. void help(void);
  41. };
  42. class shape
  43. {
  44. public:
  45. void line_hor(int, int, int, char);
  46. void line_ver(int, int, int, char);
  47. void box(int, int, int, int, char);
  48. };
  49. class initial
  50. {
  51. public:
  52. void add_to_file(int, char t_name[30], char t_address[30], float);
  53. void display_list(void);
  54. void delete_account(int);
  55. void update_balance(int, char t_name[30], char t_address[30], float);
  56. void modify(void);
  57. int last_accno(void);
  58. int found_account(int);
  59. char *return_name(int);
  60. char *return_address(int);
  61. float give_balance(int);
  62. int recordno(int);
  63. void display(int);
  64. private:
  65. };
  66. void modify_account(int, char t_name[30], char t_address [30]);
  67. int accno;
  68. char name[30], address[30];
  69. float balance;
  70. };
  71. class account
  72. {
  73. public:
  74. void new_account(void);
  75. void close_account(void);
  76. void display_account(void);
  77. void transaction(void);
  78. void clear(int, int);
  79. void month_report(void);
  80. private:
  81. void add_to_file(int, int, int, int,char,char t_type[10], float, float, float);
  82. void delete_account(int);
  83. int no_of_days(int, int, int, int, int, int);
  84. float calculate_interest(int, float);
  85. void display(int);
  86. void box_for_display(int);
  87. int accno;
  88. char type[10];
  89. int dd, mm, yy;
  90. char tran;
  91. float interest, amount, balance;
  92. };
  93. void main_menu::normalvideo(int x, int y,char *str)
  94. {
  95. gotoxy(x,y);
  96. cprintf("%s", str);
  97. }
  98. void main_menu::reversevideo(int x, int y,char *str)
  99. {
  100. textcolor(5+143);
  101. textbackground(WHITE);
  102. gotoxy(x,y);
  103. cprintf("%s",str);
  104. textcolor(GREEN);
  105. textbackground(BLACK);
  106. }
  107. void main_menu::box(int x1,int y1,int x2,int y2)
  108. {
  109. for(int col=x1;col<x2;col++)
  110. {
  111. gotoxy(col,y1);
  112. cprintf("%c",196);
  113. gotoxy(col,y2);
  114. cprintf("%c",196);
  115. }
  116. for(int row=l;row<y2;row++)
  117. {
  118. gotoxy(x1,row);
  119. cprintf("%c",179);
  120. gotoxy(x2,row);
  121. cprintf("%c",179);
  122. }
  123. gotoxy(x1,y1);
  124. cprintf("%c",218);
  125. gotoxy(x1,y2);
  126. cprintf("%c", 192);
  127. gotoxy(x2,y1);
  128. cprintf("%c",191);
  129. gotoxy(x2,y2);
  130. cprintf("%c",217);
  131. }
  132. char main_menu::menu()
  133. {
  134. clrscr();
  135. textcolor(22);
  136. box(20, 6, 65, 20);
  137. box(18, 4, 67, 22);
  138. textcolor(5+143);
  139. gotoxy(36, 5);
  140. textbackground(BLUE);
  141. cprintf("B A N K I N G");
  142. textbackground(BLACK);
  143. textcolor(22);
  144. for(i = 1; i < 7; i++)
  145. normalvideo(32, i+10, a[i]);
  146. reversevideo(32, 10, a[0]);
  147. i = done = 0;
  148. _setcursortype(_NOCURSOR);
  149. do
  150. {
  151. int key = getch();
  152. switch (key)
  153. {
  154. case 00:
  155. key = getch();
  156. switch (key)
  157. {
  158. case 72:
  159. normalvideo(32, i+10, a[i]);
  160. i--;
  161. if (i == -1)
  162. i = 6;
  163. reversevideo(32,i+10,a[i]);
  164. break;
  165. case 80:
  166. normalvideo(32, i+10, a[i]);
  167. i++;
  168. if (i == 7)
  169. i = 0;
  170. reversevideo(32, i+10, a[i]);
  171. break;
  172. }
  173. break;
  174. case 13:
  175. done = 1;
  176. }
  177. }
  178. while (!done);
  179. setcursortype(NOCURSOR);
  180. return(i+49);
  181. }
  182. void main_menu::control_menu()
  183. {
  184. char choice;
  185. account a;
  186. do
  187. {
  188. choice = menu());
  189. clrscr();
  190. switch (choice)
  191. {
  192. case '1':
  193. setcursortype(NORMALCURSOR);
  194. box(3, 1, 75, 24);
  195. box(5, 2, 73, 23);
  196. a.new_account();
  197. break;
  198. case '2':
  199. box(3, 1, 75, 24);
  200. box(5, 2, 73, 23);
  201. initial ini;
  202. ini.display_list();
  203. break;
  204. case '3':
  205. box(3, 1, 75, 24);
  206. box(5, 2, 73, 23);
  207. setcursortype(NORMALCURSOR);
  208. a.display_account();
  209. break;
  210. case '4':
  211. box(3, 1, 75, 24);
  212. box(5, 2, 73, 23);
  213. account a;
  214. setcursortype(NORMALCURSOR);
  215. a.transaction();
  216. break;
  217. case '5':
  218. box(3, 1, 75, 24);
  219. box(5, 2, 73, 23);
  220. setcursortype(_NORMALCURSOR);
  221. a.month_report();
  222. break;
  223. case '6':
  224. box(3, 1, 75, 24);
  225. box(5, 2, 73, 23);
  226. gotoxy(10,10);
  227. edit_menu();
  228. break;
  229. case '7' :exit(0);
  230. }
  231. } while (choice != 6);
  232. char main_menu::e_menu()
  233. clrscr();
  234. textcolor(22);
  235. box(25,6,60,15);
  236. box(23,4,62,17);
  237. textcolor(5+143);
  238. gotoxy(34,5);
  239. textbackground(GREEN);
  240. cprintf("EDIT - MENU");
  241. textcolor(22);
  242. textbackground(BLACK);
  243. for (i=1;i < 3; i++)
  244. normalvideo(32, i+10, b[i]);
  245. reversevideo(32, 10, b[0]);
  246. i = done = 0;
  247. _setcursortype(NOCURSOR);
  248. do
  249. {
  250. int key = getch();
  251. switch (key)
  252. {
  253. case 00:
  254. key = getch();
  255. switch (key)
  256. {
  257. case 72:
  258. normalvideo(32, i+10, b[i]);
  259. i--;
  260. if (i == -1)
  261. i = 2;
  262. reversevideo(32, i+10, b[i]);
  263. break;
  264. case 80:
  265. normalvideo(32, i+10, b[i]);
  266. }
  267. }
  268. i++;
  269. if (i = 3)
  270. i=0;
  271. reversevideo(32, i+10, b[i]);
  272. break:
  273. }
  274. break;
  275. case 13:
  276. done = 1;
  277. }
  278. }
  279. while (!done);
  280. setcursortype(NOCURSOR);
  281. return(i+49);
  282. {
  283. char choice;
  284. account a;
  285. do
  286. {
  287. choice = e_menu();
  288. clrscr();
  289. switch (choice)
  290. {
  291. case '1':
  292. box(3, 1, 75, 24);
  293. box(5, 2, 73, 23);
  294. case '2':
  295. initial ini;
  296. _setcursortype(_NORMALCURSOR);
  297. ini.modify();
  298. break:
  299. case2:
  300. box(3, 1, 75, 24);
  301. box(5, 2, 73, 23);
  302. account a;
  303. _setcursortype(NORMALCURSOR);
  304. a.close_account();
  305. break;
  306. case '3':
  307. return;
  308. }
  309. } while (choice != 6);
  310. for (column1; column1 <= column2; column1++)
  311. gotoxy(column1, row);
  312. cout<<c;
  313. }
  314. }
  315. {
  316. for (rowl; rowl <= row2; row1++)
  317. {
  318. gotoxy(column, row1);
  319. cout<< c;
  320. }
  321. }
  322. {
  323. char ch = 218;
  324. char c1, c2, c3, c4;
  325. char 11 = 196, 12 = 179;
  326. if (c = ch)
  327. {
  328. c1=218;
  329. c2 = 191;
  330. c3=217; c4 = 217;
  331. 11 = 196;
  332. 12 = 179;
  333. }
  334. else
  335. {
  336. c1 = c;
  337. c2 = c;
  338. c3 = c;
  339. c4= c;
  340. 11 = c;
  341. c2 = c;
  342. }
  343. gotoxy(columnl, row1);
  344. cout<< cl;
  345. gotoxy(column2, row1);
  346. cout<<< c2;
  347. gotoxy(columnl, row2);
  348. cout<<< c3;
  349. gotoxy(column2, row2);
  350. cout<< c4;
  351. column1++;
  352. column2--;
  353. line_hor(column1, column2, row1, 11); //Horizontal line
  354. line_hor(column1, column2, row2, 11);
  355. column 1 --;
  356. column2++;
  357. rowl++;
  358. row2--;
  359. line_ver(rowl, row2, column1, 12); // Vertical line
  360. line_ver(row1, row2, column2, 12);
  361. clrscr(); setbkcolor(7);
  362.  
  363.  
  364. settextstyle(7,HORIZ_DIR,4);
  365. outtextxy(70,20,"Welcome to Banking System");
  366. settextstyle(2,HORIZ_DIR,5);
  367. outtextxy(60,100,"You can keep record of daily banking transaction");
  368. delay(2);
  369. outtextxy(60,130,"This program is capable of holding any no. of A/c");
  370. delay(2);
  371. outtextxy(60,160,"-In first option you can open new A/c");
  372. delay(2);
  373. outtextxy(60,190,"-In second option you can see the list of all A/c's");
  374. delay(2);
  375. outtextxy(60,220,"-In third option you can see all trans. of ind. A/c");
  376. delay(2);
  377. outtextxy(60,250,"-In fourth optiion you can do banking transactions");
  378. delay(2);
  379. outtextxy(60,280,"(Deposit/Withdraw)");
  380. delay(2);
  381. outtextxy(60,310,"-In fifth opt. you can take monthly ind. A/c report");
  382. delay(2);
  383. delay(2);
  384. outtextxy(60,340,"-In sixth opt. you can modify or delete any account");
  385. outtextxy(60,370,"Note-:Opening amount should not less that Rs. 500/-");
  386. delay(2);
  387. outtextxy(60,400,"-And last option is Quit (Exit to Window)");
  388. delay(2);
  389. settextstyle(7,HORIZ_DIR,4);
  390. outtextxy(80,420,"Press any key to continue...");
  391. getch();
  392. }
  393.  
  394.  
  395. {
  396. clrscr();
  397. int j;
  398. char t_acc[10];
  399. int t, t_accno;
  400. gotoxy(17, 1);
  401. cout<<"&lt;0>=Exit";
  402. gotoxy(5,5);
  403. cout<<"Enter the account no. ";
  404. gets(t_acc);
  405. t = atoi(t_acc);
  406. t_accno = t;
  407. if (t_accno=0)
  408. return;
  409. clrscr();
  410. if (!found_account(t_accno))
  411. {
  412. gotoxy(5, 5);
  413. cout<<"\7Account not found";
  414. getch();
  415. return;
  416. }
  417. gotoxy(71, 1);
  418. cout<<"&lt;0>=Exit";
  419. textbackground(WHITE);
  420. gotoxy(3, 3);
  421. for(j=1;j<=76; j++)
  422. cprintf(" ");
  423. textbackground(BLACK);
  424. textcolor(BLACK+BLINK);
  425. textbackground(WHITE);
  426. gotoxy(30, 3);
  427. cprintf("Modify Account Screen");
  428. textcolor(LIGHTGRAY);
  429. textbackground(BLACK);
  430. int dl, ml, yl;
  431. struct date d;
  432. getdate(&d);
  433. d1 = d.da_day;
  434. ml = d.da_mon;
  435. yl = d.da_year; gotoxy(4, 2);
  436. cout<<"Date: " << dl <<"/"<<ml <<<"/"<<yl;
  437. char ch;
  438. display(t_accno);
  439. account a;
  440. do
  441. {
  442. a.clear(5, 13);
  443. gotoxy(5, 13);
  444. cout<<<< "Modify this account <y/n>: ";
  445. ch = getche();
  446. if (ch='0')
  447. return;
  448. ch = toupper(ch);
  449. } while (ch!= 'N' && ch != 'Y');
  450. if (ch == 'N')
  451. return;
  452. int modified = 0, valid;
  453. char t_name[30], t_address[30];
  454. gotoxy(5, 15);
  455. cout<<"Name: ";
  456. gotoxy(5, 16);
  457. cout<<"Address: ";
  458. do
  459. {
  460. a.clear(15, 15);
  461. a.clear(5, 23);
  462. gotoxy(5, 23);
  463. cout<<"Enter Name or Press Enter for No Change";
  464. valid = 1;
  465. gotoxy(15, 15);
  466. gets(t_name);
  467. strupr(t_name);
  468. if (t_name[0] == '0')
  469. return;
  470. if (strlen(t_name) > 25)
  471. {
  472. valid = 0;
  473. gotoxy(5, 23);
  474. cprintf("\7Name should not greater than 25");
  475. getch();
  476. }
  477. } while (!valid);
  478. do
  479. {
  480. a.clear(15, 16);
  481. a.clear(5, 23);
  482. gotoxy(5, 23);
  483. cout<<"Enter Address or press enter for no Change";
  484. valid = 1;
  485. gotoxy(15, 16);
  486. gets(t_address);
  487. strupr(t_address);
  488. if (t_address[0] = '0')
  489. return;
  490. if (strlen(t_address) >25)
  491. valid = 0;
  492. gotoxy(5, 23);
  493. cprintf("\7Address should not greater than 25");
  494. getch();
  495. }
  496. } while (!valid);
  497. if (strlen(t_address) > 0)
  498. modified = 1;
  499. if (!modified)
  500. return;
  501. a.clear(5,23);
  502. do
  503. a.clear(5, 23);
  504. gotoxy(5,18);
  505. cout<<"Do you want to save Changes<Y/N>:";
  506. ch=getche();
  507. if(ch=='0')
  508. return;
  509. ch=toupper(ch);
  510. }while(ch!='N'&& ch!'Y');
  511. if(ch=='N')
  512. return;
  513. gotoxy(5,21);
  514. cout<<"\7Record modifyed";
  515. gotoxy(5,23);
  516. cout<<"Press any key to continue...";
  517. getch();
  518. }
  519. {
  520. fstrean file;
  521. file.open;
  522. file.seekg(0,ios::beg);
  523. if(t_accno==accno)
  524. {
  525. gotoxy(8,5);
  526. cout<<"Account no."<<accno;
  527. gotoxy(10,8);
  528. cout<<Address:";
  529. puts(address);
  530. gotoxy(10,9);
  531. cout<<"Address:";
  532. puts(address);
  533. gotoxy(10,10);
  534. cout<<"Balace:"<<setw(15)
  535. <<setprecision(2)
  536. <<setiosflags(ios::showpoint)
  537. <<setionsflags(ios::fixed)<<balance;
  538. break;
  539. }
  540. }
  541. file.close();
  542. }
  543. {
  544. int recno;
  545. recno=recordno(t_accno);
  546. fstream file;
  547. file.open("INITIAL.dat",ios::out|ios::ate);
  548. strcpy(name,t_name);
  549. strcpy(address, t_address);
  550. int location;
  551. location = (recno-1)* sizeof(initial);
  552. file.seekp(location);
  553. file.write((char *)this, sizeof(initial));
  554. file.close();
  555. return;
  556. int initial::last_accno(void)
  557. {
  558. fstream file;
  559. file.open("INITIAL.dat", ios::in);
  560. file.seekg(0, ios::beg);
  561. int count = 0;
  562. count = accno;
  563. file.close();
  564. return count;
  565. accno=t_accno;
  566. strcpy(name, t_name);
  567. strcpy(address, t_address);
  568. balance=t balance;
  569. fstream file:
  570. file.open("INITIAL.dat", ios::out ios::app);
  571. file.write((char *)this, sizeof(initial));
  572. file.close();
  573. void initial::delete_account(int t_accno)
  574. {
  575. fstream file;
  576. file.open("INITIAL.dat", ios::in);
  577. fstream temp;
  578. temp.open("TEMP.dat", ios::out);
  579. file.seekg(0,ios::beg);
  580. while (!file.eof()
  581. {
  582. file.read((char *)this, sizeof(initial));
  583. if (file.eof()
  584. break;
  585. if (accno !=t_accno)
  586. temp.write((char *)this, sizeof(initial));
  587. }
  588. file.close();
  589. temp.close();
  590. file.open("INITIAL.dat", ios::out);
  591. temp.open("TEMP.dat", ios::in);
  592. temp.seekg(0, ios::beg);
  593. while (!temp.eof())
  594. {
  595. temp.read((char *)this, sizeof(initial));
  596. if (temp.eof())
  597. break;
  598. if (accno != t_accno)
  599. file.write((char *)this, sizeof(initial));
  600. }
  601. file.close();
  602. temp.close();
  603. {
  604. fstream file;
  605. file.open("BANKING.dat", ios::app);
  606. accno=t_accno;
  607. getch();
  608. dd = dl;
  609. mm = ml;
  610. yy = y1;
  611. tran = t tran;
  612. strcpy(type, t_type);
  613. interest = t interest;
  614. amount = t_amount;
  615. balance = t balance;
  616. file.write((char *)this, sizeof(account));
  617. file.close();
  618. {
  619. fstream file;
  620. file.open("BANKING.dat", ios::in);
  621. fstream temp;
  622. temp.open("TEMP.dat", ios::out);
  623. file.seekg(0, ios::beg);
  624. while (!file.eof())
  625. {
  626. file.read((char *)this, sizeof(account));
  627. if (file.eof())
  628. break;
  629. if (accno !=t_accno)
  630. temp.write((char *)this, sizeof(account));
  631. }
  632. file.close();
  633. temp.close();
  634. file.open("BANKING.dat", ios::out);
  635. temp.open("TEMP.dat", ios::in);
  636. temp.seekg(0, ios::beg);
  637. while (!temp.eof())
  638. {
  639. temp.read((char *)this, sizeof(account));
  640. if (temp.eof()
  641. break;
  642. if (accno !=t_accno)
  643. file.write((char *)this, sizeof(account));
  644. }
  645. file.close();
  646. temp.close();
  647. {
  648. clrscr();
  649. int flag;
  650. float t bal = 0.0;
  651. fstream file;
  652. gotoxy(25,2);
  653. cout<<"Accounts List in Bank";
  654. gotoxy(25, 3);
  655. cout<<
  656. 11
  657. int dl, ml, yl;
  658. struct date d;
  659. // For extracting system date
  660. getdate(&d);
  661. d1 = d.da_day;
  662. ml = d.da_mon;
  663. yl = d.da_year;
  664. gotoxy(62, 3);
  665. cout<<"Date: " << dl <<"/"<<ml <<<"/"<<yl;
  666. gotoxy(1, 4);
  667. for (int j = 1; j <= 79; j++)
  668. cout<<<<<"=";
  669. gotoxy(1, 5);
  670. cout<<"Accno#":
  671. gotoxy(10,5);
  672. cout<<"Name";
  673. gotoxy(30,5);
  674. cout<<"Address";
  675. gotoxy(65,5);
  676. cout<<"Balance";
  677. gotoxy(1, 6);
  678. for (j = 1; j <= 79; j++)
  679. cout<<"=";
  680. file.open("INITIAL.dat", ios::in);
  681. file.seekg(0,ios::beg);
  682. int row = 7;
  683. while (file.read((char *)this, sizeof(initial)))
  684. {
  685. flag = 0;
  686. delay(2);
  687. gotoxy(3, row);
  688. cout<< accno;
  689. gotoxy(10, row);
  690. puts(name);
  691. gotoxy(30, row);
  692. puts(address);
  693. gotoxy(65, row);
  694. cout<<<<setw(15)<<setprecision(2) <<setiosflags(ios::left)
  695. <<setiosflags(ios::showpoint)<<<<setiosflags(ios::fixed)<<balance;
  696. t_bal=t_bal + balance;
  697. row++;
  698. if (row >23)
  699. {
  700. flag = 1;
  701. row = 6;
  702. gotoxy(4, 24);
  703. cout<<"Press any key to continue.... ";
  704. getch();
  705. clrscr();
  706. }
  707. }
  708. gotoxy(1, row);
  709. for (j = 1; j <= 79; j++)
  710. cout<<"=".
  711. row++;
  712. gotoxy(3, row);
  713. cout<<"Total Balance in Bank is: ";
  714. gotoxy(65, row);
  715. cout<<<setw(15)<<<setprecision(2)<<setiosflags(ios::left)
  716. <<setiosflags(ios::showpoint)<<setiosflags(ios::fixed)<<t_bal;
  717. file.close();
  718. if (!flag)
  719. {
  720. gotoxy(4, 24);
  721. cout<<<< "Press any key to continue...";
  722. getch(); }
  723. {
  724. for (int j = col; j <= 79; j++)
  725. {
  726. gotoxy(j, row);
  727. cout<<"".
  728. }
  729. int initial::found_account(int t_accno)
  730. {
  731. fstream file;
  732. file.open("INITIAL.dat", ios::in);
  733. file.seekg(0, ios::beg);
  734. int found = 0;
  735. {
  736. if(accno==t_accno)
  737. {
  738. found=1;
  739. break;
  740. }
  741. }
  742. file.close();
  743. returnfound;
  744. }
  745. {
  746. fstream file;
  747. file.open("INITIAL.dat",ios::in);
  748. file.seekg(0,ios::beg);
  749. chat t_name[30];
  750. {
  751. if(accno=t-accno)
  752. {
  753. strcpy(t-name,name);
  754. break;
  755. }
  756. }
  757. file.close();
  758. return t_name;
  759.  
  760.  
  761.  
  762.  
  763.  
Success #stdin #stdout 0.02s 25460KB
stdin
Standard input is empty
stdout
#include<iostream.h>
#include<fstream.h>
#include<process.h>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<iomanip.h>
#include<graphics.h>
typedef char option[15];
const int ROW = 10,COL = 10;
int scan;
 int ascii;
option a[]= {
"NewAccount",
"ListofAccounts",
"IndAccount",
"Daily Trans",
"MonthlyReport",
"EditAccount",
"Exit"};
option b[] = {
"Modify Account",
"Closeaccount",
"Quit"
};
class main_menu
{
int i,done;
public:
void normalvideo(int x, int y,char *str);
void reversevideo(int x, int y,char *str);
void box(int x1,int y1,int x2,int y2);
char menu();
void control_menu();
char e_menu();
void edit_menu();
void help(void);
};
class shape
{
public:
void line_hor(int, int, int, char);
void line_ver(int, int, int, char);
void box(int, int, int, int, char);
};
class initial
{
public:
void add_to_file(int, char t_name[30], char t_address[30], float);
void display_list(void);
void delete_account(int);
void update_balance(int, char t_name[30], char t_address[30], float);
void modify(void);
int last_accno(void);
int found_account(int);
char *return_name(int);
char *return_address(int);
float give_balance(int);
int recordno(int);
void display(int);
private:
};
void modify_account(int, char t_name[30], char t_address [30]);
int accno;
char name[30], address[30];
float balance;
};
class account
{
public:
void new_account(void);
void close_account(void);
void display_account(void);
void transaction(void);
void clear(int, int);
void month_report(void);
private:
void add_to_file(int, int, int, int,char,char t_type[10], float, float, float);
void delete_account(int);
int no_of_days(int, int, int, int, int, int);
float calculate_interest(int, float);
void display(int);
void box_for_display(int);
int accno;
char type[10];
int dd, mm, yy;
char tran;
float interest, amount, balance;
};
void main_menu::normalvideo(int x, int y,char *str)
{
gotoxy(x,y);
cprintf("%s", str);
}
void main_menu::reversevideo(int x, int y,char *str)
{
textcolor(5+143);
textbackground(WHITE);
gotoxy(x,y);
cprintf("%s",str);
textcolor(GREEN);
textbackground(BLACK);
}
void main_menu::box(int x1,int y1,int x2,int y2)
{
for(int col=x1;col<x2;col++)
{
gotoxy(col,y1);
cprintf("%c",196);
gotoxy(col,y2);
cprintf("%c",196);
}
for(int row=l;row<y2;row++)
{
gotoxy(x1,row);
cprintf("%c",179);
gotoxy(x2,row);
cprintf("%c",179);
}
gotoxy(x1,y1);
cprintf("%c",218);
gotoxy(x1,y2);
cprintf("%c", 192);
gotoxy(x2,y1);
cprintf("%c",191);
gotoxy(x2,y2);
cprintf("%c",217);
}
char main_menu::menu()
{
clrscr();
textcolor(22);
box(20, 6, 65, 20);
box(18, 4, 67, 22);
textcolor(5+143);
gotoxy(36, 5);
textbackground(BLUE);
cprintf("B A N K I N G");
textbackground(BLACK);
textcolor(22);
for(i = 1; i < 7; i++)
normalvideo(32, i+10, a[i]);
reversevideo(32, 10, a[0]);
i = done = 0;
_setcursortype(_NOCURSOR);
do
{
int key = getch();
switch (key)
{
case 00:
key = getch();
switch (key)
{
case 72:
normalvideo(32, i+10, a[i]);
i--;
if (i == -1)
i = 6;
reversevideo(32,i+10,a[i]);
break;
case 80:
normalvideo(32, i+10, a[i]);
i++;
if (i == 7)
i = 0;
reversevideo(32, i+10, a[i]);
break;
}
break;
case 13:
done = 1;
}
}
while (!done);
setcursortype(NOCURSOR);
return(i+49);
}
void main_menu::control_menu()
{
char choice;
account a;
do
{
choice = menu());
clrscr();
switch (choice)
{
case '1':
setcursortype(NORMALCURSOR);
box(3, 1, 75, 24);
box(5, 2, 73, 23);
a.new_account();
break;
case '2':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
initial ini;
ini.display_list();
break;
case '3':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
setcursortype(NORMALCURSOR);
a.display_account();
break;
case '4':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
account a;
setcursortype(NORMALCURSOR);
a.transaction();
break;
case '5':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
setcursortype(_NORMALCURSOR);
a.month_report();
break;
case '6':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
gotoxy(10,10);
edit_menu();
break;
case '7' :exit(0);
}
} while (choice != 6);
char main_menu::e_menu()
clrscr();
textcolor(22);
box(25,6,60,15);
box(23,4,62,17);
textcolor(5+143);
gotoxy(34,5);
textbackground(GREEN);
cprintf("EDIT - MENU");
textcolor(22);
textbackground(BLACK);
for (i=1;i < 3; i++)
normalvideo(32, i+10, b[i]);
reversevideo(32, 10, b[0]);
i = done = 0;
_setcursortype(NOCURSOR);
do
{
int key = getch();
switch (key)
{
case 00:
key = getch();
switch (key)
{
case 72:
normalvideo(32, i+10, b[i]);
i--;
if (i == -1)
i = 2;
reversevideo(32, i+10, b[i]);
break;
case 80:
normalvideo(32, i+10, b[i]);
}
}
i++;
if (i = 3)
i=0;
reversevideo(32, i+10, b[i]);
break:
}
break;
case 13:
done = 1;
}
}
while (!done);
setcursortype(NOCURSOR);
return(i+49);
{
char choice;
account a;
do
{
choice = e_menu();
clrscr();
switch (choice)
{
case '1':
box(3, 1, 75, 24);
box(5, 2, 73, 23);
case '2':
initial ini;
_setcursortype(_NORMALCURSOR);
ini.modify();
break:
case’2’:
box(3, 1, 75, 24);
box(5, 2, 73, 23);
account a;
_setcursortype(NORMALCURSOR);
a.close_account();
break;
case '3':
return;
}
} while (choice != 6);
for (column1; column1 <= column2; column1++)
gotoxy(column1, row);
cout<<c;
}
}
{
for (rowl; rowl <= row2; row1++)
{
gotoxy(column, row1);
cout<< c;
}
}
{
char ch = 218;
char c1, c2, c3, c4;
char 11 = 196, 12 = 179;
if (c = ch)
{
c1=218;
c2 = 191;
c3=217; c4 = 217;
11 = 196;
12 = 179;
}
else
{
c1 = c;
c2 = c;
c3 = c;
c4= c;
11 = c;
c2 = c;
}
gotoxy(columnl, row1);
cout<< cl;
gotoxy(column2, row1);
cout<<< c2;
gotoxy(columnl, row2);
cout<<< c3;
gotoxy(column2, row2);
cout<< c4;
column1++;
column2--;
line_hor(column1, column2, row1, 11); //Horizontal line
line_hor(column1, column2, row2, 11);
column 1 --;
column2++;
rowl++;
row2--;
line_ver(rowl, row2, column1, 12); // Vertical line
line_ver(row1, row2, column2, 12);
clrscr(); setbkcolor(7);


settextstyle(7,HORIZ_DIR,4);
outtextxy(70,20,"Welcome to Banking System");
settextstyle(2,HORIZ_DIR,5);
outtextxy(60,100,"You can keep record of daily banking transaction");
delay(2);
outtextxy(60,130,"This program is capable of holding any no. of A/c");
delay(2);
outtextxy(60,160,"-In first option you can open new A/c");
delay(2);
outtextxy(60,190,"-In second option you can see the list of all A/c's");
delay(2);
outtextxy(60,220,"-In third option you can see all trans. of ind. A/c");
delay(2);
outtextxy(60,250,"-In fourth optiion you can do banking transactions");
delay(2);
outtextxy(60,280,"(Deposit/Withdraw)");
delay(2);
outtextxy(60,310,"-In fifth opt. you can take monthly ind. A/c report");
delay(2);
delay(2);
outtextxy(60,340,"-In sixth opt. you can modify or delete any account");
outtextxy(60,370,"Note-:Opening amount should not less that Rs. 500/-");
delay(2);
outtextxy(60,400,"-And last option is Quit (Exit to Window)");
delay(2);
settextstyle(7,HORIZ_DIR,4);
outtextxy(80,420,"Press any key to continue...");
getch();
}


{
clrscr();
int j;
char t_acc[10];
int t, t_accno;
gotoxy(17, 1);
cout<<"&lt;0>=Exit";
gotoxy(5,5);
cout<<"Enter the account no. ";
gets(t_acc);
t = atoi(t_acc);
t_accno = t;
if (t_accno=0)
return;
clrscr();
if (!found_account(t_accno))
{
gotoxy(5, 5);
cout<<"\7Account not found";
getch();
return;
}
gotoxy(71, 1);
cout<<"&lt;0>=Exit";
textbackground(WHITE);
gotoxy(3, 3);
for(j=1;j<=76; j++)
cprintf(" ");
textbackground(BLACK);
textcolor(BLACK+BLINK);
textbackground(WHITE);
gotoxy(30, 3);
cprintf("Modify Account Screen");
textcolor(LIGHTGRAY);
textbackground(BLACK);
int dl, ml, yl;
struct date d;
getdate(&d);
d1 = d.da_day;
ml = d.da_mon;
yl = d.da_year; gotoxy(4, 2);
cout<<"Date: " << dl <<"/"<<ml <<<"/"<<yl;
char ch;
display(t_accno);
account a;
do
{
a.clear(5, 13);
gotoxy(5, 13);
cout<<<< "Modify this account <y/n>: ";
ch = getche();
if (ch='0')
return;
ch = toupper(ch);
} while (ch!= 'N' && ch != 'Y');
if (ch == 'N')
return;
int modified = 0, valid;
char t_name[30], t_address[30];
gotoxy(5, 15);
cout<<"Name: ";
gotoxy(5, 16);
cout<<"Address: ";
do
{
a.clear(15, 15);
a.clear(5, 23);
gotoxy(5, 23);
cout<<"Enter Name or Press Enter for No Change";
valid = 1;
gotoxy(15, 15);
gets(t_name);
strupr(t_name);
if (t_name[0] == '0')
return;
if (strlen(t_name) > 25)
{
valid = 0;
gotoxy(5, 23);
cprintf("\7Name should not greater than 25");
getch();
}
} while (!valid);
do
{
a.clear(15, 16);
a.clear(5, 23);
gotoxy(5, 23);
cout<<"Enter Address or press enter for no Change";
valid = 1;
gotoxy(15, 16);
gets(t_address);
strupr(t_address);
if (t_address[0] = '0')
return;
if (strlen(t_address) >25)
valid = 0;
gotoxy(5, 23);
cprintf("\7Address should not greater than 25");
getch();
}
} while (!valid);
if (strlen(t_address) > 0)
modified = 1;
if (!modified)
return;
a.clear(5,23);
do
a.clear(5, 23);
gotoxy(5,18);
cout<<"Do you want to save Changes<Y/N>:";
ch=getche();
if(ch=='0')
return;
ch=toupper(ch);
}while(ch!='N'&& ch!'Y');
if(ch=='N')
return;
gotoxy(5,21);
cout<<"\7Record modifyed";
gotoxy(5,23);
cout<<"Press any key to continue...";
getch();
}
{
fstrean file;
file.open;
file.seekg(0,ios::beg);
if(t_accno==accno)
{
gotoxy(8,5);
cout<<"Account no."<<accno;
gotoxy(10,8);
cout<<Address:";
puts(address);
gotoxy(10,9);
cout<<"Address:";
puts(address);
gotoxy(10,10);
cout<<"Balace:"<<setw(15)
<<setprecision(2)
<<setiosflags(ios::showpoint)
<<setionsflags(ios::fixed)<<balance;
break;
}
}
file.close();
}
{
int recno;
recno=recordno(t_accno);
fstream file;
file.open("INITIAL.dat",ios::out|ios::ate);
strcpy(name,t_name);
strcpy(address, t_address);
int location;
location = (recno-1)* sizeof(initial);
file.seekp(location);
file.write((char *)this, sizeof(initial));
file.close();
return;
int initial::last_accno(void)
{
fstream file;
file.open("INITIAL.dat", ios::in);
file.seekg(0, ios::beg);
int count = 0;
count = accno;
file.close();
return count;
accno=t_accno;
strcpy(name, t_name);
strcpy(address, t_address);
balance=t balance;
fstream file:
file.open("INITIAL.dat", ios::out ios::app);
file.write((char *)this, sizeof(initial));
file.close();
void initial::delete_account(int t_accno)
{
fstream file;
file.open("INITIAL.dat", ios::in);
fstream temp;
temp.open("TEMP.dat", ios::out);
file.seekg(0,ios::beg);
while (!file.eof()
{
file.read((char *)this, sizeof(initial));
if (file.eof()
break;
if (accno !=t_accno)
temp.write((char *)this, sizeof(initial));
}
file.close();
temp.close();
file.open("INITIAL.dat", ios::out);
temp.open("TEMP.dat", ios::in);
temp.seekg(0, ios::beg);
while (!temp.eof())
{
temp.read((char *)this, sizeof(initial));
if (temp.eof())
break;
if (accno != t_accno)
file.write((char *)this, sizeof(initial));
}
file.close();
temp.close();
{
fstream file;
file.open("BANKING.dat", ios::app);
accno=t_accno;
getch();
dd = dl;
mm = ml;
yy = y1;
tran = t tran;
strcpy(type, t_type);
interest = t interest;
amount = t_amount;
balance = t balance;
file.write((char *)this, sizeof(account));
file.close();
{
fstream file;
file.open("BANKING.dat", ios::in);
fstream temp;
temp.open("TEMP.dat", ios::out);
file.seekg(0, ios::beg);
while (!file.eof())
{
file.read((char *)this, sizeof(account));
if (file.eof())
break;
if (accno !=t_accno)
temp.write((char *)this, sizeof(account));
}
file.close();
temp.close();
file.open("BANKING.dat", ios::out);
temp.open("TEMP.dat", ios::in);
temp.seekg(0, ios::beg);
while (!temp.eof())
{
temp.read((char *)this, sizeof(account));
if (temp.eof()
break;
if (accno !=t_accno)
file.write((char *)this, sizeof(account));
}
file.close();
temp.close();
{
clrscr();
int flag;
float t bal = 0.0;
fstream file;
gotoxy(25,2);
cout<<"Accounts List in Bank";
gotoxy(25, 3);
cout<<
11
int dl, ml, yl;
struct date d;
// For extracting system date
getdate(&d);
d1 = d.da_day;
ml = d.da_mon;
yl = d.da_year;
gotoxy(62, 3);
cout<<"Date: " << dl <<"/"<<ml <<<"/"<<yl;
gotoxy(1, 4);
for (int j = 1; j <= 79; j++)
cout<<<<<"=";
gotoxy(1, 5);
cout<<"Accno#":
gotoxy(10,5);
cout<<"Name";
gotoxy(30,5);
cout<<"Address";
gotoxy(65,5);
cout<<"Balance";
gotoxy(1, 6);
for (j = 1; j <= 79; j++)
cout<<"=";
file.open("INITIAL.dat", ios::in);
file.seekg(0,ios::beg);
int row = 7;
while (file.read((char *)this, sizeof(initial)))
{
flag = 0;
delay(2);
gotoxy(3, row);
cout<< accno;
gotoxy(10, row);
puts(name);
gotoxy(30, row);
puts(address);
gotoxy(65, row);
cout<<<<setw(15)<<setprecision(2) <<setiosflags(ios::left)
<<setiosflags(ios::showpoint)<<<<setiosflags(ios::fixed)<<balance;
t_bal=t_bal + balance;
row++;
if (row >23)
{
flag = 1;
row = 6;
gotoxy(4, 24);
cout<<"Press any key to continue.... ";
getch();
clrscr();
}
}
gotoxy(1, row);
for (j = 1; j <= 79; j++)
cout<<"=".
row++;
gotoxy(3, row);
cout<<"Total Balance in Bank is: ";
gotoxy(65, row);
cout<<<setw(15)<<<setprecision(2)<<setiosflags(ios::left)
<<setiosflags(ios::showpoint)<<setiosflags(ios::fixed)<<t_bal;
file.close();
if (!flag)
{
gotoxy(4, 24);
cout<<<< "Press any key to continue...";
getch(); }
{
for (int j = col; j <= 79; j++)
{
gotoxy(j, row);
cout<<"".
}
int initial::found_account(int t_accno)
{
fstream file;
file.open("INITIAL.dat", ios::in);
file.seekg(0, ios::beg);
int found = 0;
{
if(accno==t_accno)
{
found=1;
break;
}
}
file.close();
returnfound;
}
{
fstream file;
file.open("INITIAL.dat",ios::in);
file.seekg(0,ios::beg);
chat t_name[30];
{
if(accno=t-accno)
{
strcpy(t-name,name);
break;
}
}
file.close();
return t_name;