Bank Management System

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
msaqib msaqib is offline Offline Nov 6th, 2005, 10:22 pm |
0
This is an automated system for Bank Management. It uses files to handle the daily transactions, account management and user management.
Nice graphical layout and mouse functionality.
Manager can add, edit and delete the users and manage the user accounts.
Code From: http://www.mycplus.com/cat.asp?CID=23
Quick reply to this message  
C Syntax
  1. /*
  2. Muhammad Saqib
  3. Email: saqib@mycplus.com
  4. Please change BGI directory accouding to your TC Directory
  5. By default it is "E:\tc\bgi"
  6. */
  7. #include<iostream.h>
  8. #include<conio.h>
  9. #include<graphics.h>
  10. #include<malloc.h>
  11. #include<dos.h>
  12. #include<fstream.h>
  13. #include<stdlib.h>
  14. #include<string.h>
  15. void intro(void);
  16. int main_menu(void);
  17. void new_account(void);
  18. void new_account_gui(void);
  19. int getaccount_no(char *);
  20. void sav_account(int,char*,int,char*,int,int,int,int,int);
  21. void update_main(char *);
  22. void process(void);
  23. void list_all(void);
  24. void print_it(char*);
  25. void list_all_gui(void);
  26. void trans_menu(void);
  27. int trans_gui(void);
  28. void show_trans(void);
  29. void mod_trans(void);
  30. void see_it(void);
  31. void report(void);
  32. void dep_gui(void);
  33. void deposite(void);
  34. void mod_choice(void);
  35. void withdraw(void);
  36. main(){
  37. intro();
  38. process();
  39. return 0;
  40. }
  41. void process(void){
  42. int option;
  43. option=main_menu();
  44. if(option==1)
  45. new_account();
  46. if(option==2)
  47. list_all();
  48. if(option==3)
  49. trans_menu();
  50. if(option==4)
  51. exit(0);
  52. }
  53. void intro(void){
  54. void *image;
  55. int size;
  56. int dr=9,mode=2;
  57. initgraph(&dr,&mode,"..\\bgi");
  58. size=imagesize(140,140,500,250);
  59. image=malloc(size);
  60. setfillstyle(SOLID_FILL,GREEN);
  61. circle(200,200,50);
  62. floodfill(200,200,WHITE);
  63. setcolor(LIGHTGRAY);
  64. circle(200,200,19);
  65. setcolor(WHITE);
  66. circle(200,200,18);
  67. circle(200,200,49);
  68. circle(200,200,53);
  69. circle(200,200,20);
  70.  
  71. arc(215,215,350,90,30);
  72. arc(210,182,90,194,30);
  73. arc(180,195,180,300,30);
  74. settextstyle(1,HORIZ_DIR,1);
  75. setcolor(LIGHTGRAY);
  76. outtextxy(270,180,"National Bank");
  77.  
  78. outtextxy(270,185,"___________________");
  79. outtextxy(270,210,"Of Pakistan Pvt Ltd.");
  80. settextstyle(0,HORIZ_DIR,0);
  81. setcolor(DARKGRAY);
  82. outtextxy(270,240,"COPYRIGHT 2002");
  83. getimage(141,141,499,259,image);
  84. cleardevice();
  85. for(int count=1;count<300;count+=2)
  86. putimage(1+count,100,image,COPY_PUT);
  87. for(int down=0;down<640;++down)
  88. {
  89. delay(5);
  90. line(1,220,1+down,220);
  91. }
  92. setcolor(BLUE);
  93. for(int bottom=0;bottom<300;bottom+=4)
  94. line(1,220+bottom,640,220+bottom);
  95. free(image);
  96. getch();
  97. closegraph();
  98. }
  99. // ----------------- m a i n - m e n u ---------------------
  100. int main_menu(void){
  101. int option;
  102. int size;
  103. int dr=9,mode=2;
  104. initgraph(&dr,&mode,"..\\bgi");
  105. void *main_window,*button_down;
  106. size=imagesize(10,70,251,351);
  107. main_window=malloc(size);
  108. size=imagesize(10,310,251,351);
  109. button_down=malloc(size);
  110. setfillstyle(SOLID_FILL,LIGHTGRAY);
  111. setcolor(DARKGRAY);
  112. rectangle(1,1,640,480);
  113. floodfill(3,3,DARKGRAY);
  114. setcolor(WHITE);
  115. line(1,1,1,480);
  116. line(1,1,640,1);
  117. setcolor(BLUE);
  118. rectangle(3,3,637,15);
  119. setfillstyle(SOLID_FILL,BLUE);
  120. floodfill(5,5,BLUE);
  121. setcolor(DARKGRAY);
  122. rectangle(620,4,635,14);
  123. rectangle(602,4,617,14);
  124. rectangle(585,4,599,14);
  125. setfillstyle(SOLID_FILL,LIGHTGRAY);
  126. floodfill(586,6,DARKGRAY);
  127. floodfill(604,6,DARKGRAY);
  128. floodfill(624,6,DARKGRAY);
  129. setcolor(BLACK);
  130. line(622,6,633,12);
  131. line(633,6,622,12);
  132. rectangle(604,6,615,12);
  133. line(587,12,597,12);
  134. setcolor(WHITE);
  135. line(620,4,620,14);
  136. line(620,4,635,4);
  137. line(602,4,617,4);
  138. line(602,4,602,14);
  139. line(584,4,599,4);
  140. line(584,4,584,14);
  141. outtextxy(8,5,"BANKING SYSTEM");
  142. setcolor(WHITE);
  143. line(5,30,635,30);
  144. line(5,60,635,60);
  145. setcolor(DARKGRAY);
  146. line(5,29,635,29);
  147. line(5,59,635,59);
  148. setcolor(DARKGRAY);
  149. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  150. rectangle(10,70,200,100);
  151. setcolor(WHITE);
  152. line(9,69,9,99);
  153. line(10,69,200,69);
  154. setcolor(BLACK);
  155. outtextxy(30,80,"M A I N M E N U");
  156. setcolor(DARKGRAY);
  157. rectangle(10,110,250,150);
  158. setcolor(BLACK);
  159. rectangle(10,110,251,151);
  160. setcolor(WHITE);
  161. line(10,110,10,150);
  162. line(10,110,250,110);
  163. setcolor(BLACK);
  164. outtextxy(40,130,"1. Create new account");
  165. setcolor(DARKGRAY);
  166. rectangle(10,160,250,200);
  167. setcolor(BLACK);
  168. rectangle(10,160,251,201);
  169. setcolor(WHITE);
  170. line(10,160,10,200);
  171. line(10,160,250,160);
  172. setcolor(BLACK);
  173. outtextxy(40,180,"2. List all accounts");
  174. setcolor(DARKGRAY);
  175. rectangle(10,210,250,250);
  176. setcolor(BLACK);
  177. rectangle(10,210,251,251);
  178. setcolor(WHITE);
  179. line(10,210,10,250);
  180. line(10,210,250,210);
  181. setcolor(BLACK);
  182. outtextxy(40,230,"3. Show individual info");
  183. setcolor(DARKGRAY);
  184. rectangle(10,260,250,300);
  185. setcolor(BLACK);
  186. rectangle(10,260,251,301);
  187. setcolor(WHITE);
  188. line(10,260,10,300);
  189. line(10,260,250,260);
  190. setcolor(BLACK);
  191. outtextxy(40,280,"4. Quit");
  192. setcolor(LIGHTGRAY);
  193. rectangle(10,310,250,350);
  194. getimage(10,70,251,351,main_window);
  195. setcolor(WHITE);
  196. rectangle(10,310,251,351);
  197. setcolor(DARKGRAY);
  198. line(10,310,10,350);
  199. line(11,311,11,350);
  200. line(10,310,250,310);
  201. line(11,311,250,311);
  202. setcolor(BLACK);
  203. getimage(10,310,251,351,button_down);
  204. cleardevice();
  205. setfillstyle(SOLID_FILL,LIGHTGRAY);
  206. setcolor(DARKGRAY);
  207. rectangle(1,1,640,480);
  208. floodfill(3,3,DARKGRAY);
  209. setcolor(WHITE);
  210. line(1,1,1,480);
  211. line(1,1,640,1);
  212. setcolor(BLUE);
  213. rectangle(3,3,637,15);
  214. setfillstyle(SOLID_FILL,BLUE);
  215. floodfill(5,5,BLUE);
  216. setcolor(DARKGRAY);
  217. rectangle(620,4,635,14);
  218. rectangle(602,4,617,14);
  219. rectangle(585,4,599,14);
  220. setfillstyle(SOLID_FILL,LIGHTGRAY);
  221. floodfill(586,6,DARKGRAY);
  222. floodfill(604,6,DARKGRAY);
  223. floodfill(624,6,DARKGRAY);
  224. setcolor(BLACK);
  225. line(622,6,633,12);
  226. line(633,6,622,12);
  227. rectangle(604,6,615,12);
  228. line(587,12,597,12);
  229. setcolor(WHITE);
  230. line(620,4,620,14);
  231. line(620,4,635,4);
  232. line(602,4,617,4);
  233. line(602,4,602,14);
  234. line(584,4,599,4);
  235. line(584,4,584,14);
  236. outtextxy(8,5,"BANKING SYSTEM");
  237. setcolor(WHITE);
  238. line(5,30,635,30);
  239. line(5,60,635,60);
  240. setcolor(DARKGRAY);
  241. line(5,29,635,29);
  242. line(5,59,635,59);
  243. setcolor(DARKGRAY);
  244. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  245. putimage(10,70,main_window,COPY_PUT);
  246. char check;
  247. setcolor(BLACK);
  248. check=getch();
  249. if(check==49)
  250. {
  251. putimage(10,110,button_down,COPY_PUT);
  252. outtextxy(40,130,"1. Create new account");
  253. option=1;
  254. delay(600);
  255. }
  256. if(check==50)
  257. {
  258. putimage(10,160,button_down,COPY_PUT);
  259. outtextxy(40,180,"2. List all accounts");
  260. option=2;
  261. delay(600);
  262. }
  263. if(check==51)
  264. {
  265. putimage(10,210,button_down,COPY_PUT);
  266. outtextxy(40,230,"3. Show individual info");
  267. option=3;
  268. delay(600);
  269. }
  270. if(check==52)
  271. {
  272. putimage(10,260,button_down,COPY_PUT);
  273. outtextxy(40,280,"4. Quit");
  274. option=4;
  275. delay(600);
  276. }
  277. free(main_window);
  278. free(button_down);
  279. cleardevice();
  280. closegraph();
  281. return(option);
  282. }
  283. void new_account(void){
  284. int withdraw=0;
  285. int deposit=0;
  286. int account_no=888;
  287. int balance=0;
  288. char address[25];
  289. char name[10]={'D','E','F','A','U','L','T'};
  290. struct date dat;
  291. getdate(&dat);
  292. account_no=getaccount_no(name);
  293. int year=dat.da_year;
  294. int day=dat.da_day;
  295. int month=dat.da_mon;
  296. --account_no;
  297. new_account_gui();
  298. gotoxy(20,9);
  299. cout<<account_no;
  300. gotoxy(42,9);
  301. cout<<day<<" of "<<month<<" "<<year;
  302. gotoxy(40,13);
  303. cout<<" ";
  304. cin>>name;
  305. gotoxy(40,17);
  306. cout<<" ";
  307. cin>>balance;
  308. gotoxy(40,21);
  309. cout<<" ";
  310. cin>>address;
  311. sav_account(account_no,name,balance,address,day,month,year,deposit,withdraw);
  312. cleardevice();
  313. closegraph();
  314. process();
  315. }
  316. int getaccount_no(char *name)
  317. {
  318. char string[10];
  319. int count=0;
  320. int account_no=0;
  321. ifstream pfile("main");
  322. if(pfile==NULL)
  323. {
  324. account_no=2;
  325. pfile.close();
  326. ofstream pfile2("main");
  327. pfile2<<name;
  328. pfile2.close();
  329. return account_no;
  330. }
  331. ifstream pfile3("main");
  332. while(string[0]!=NULL)
  333. {
  334. pfile3>>string;
  335. ++count;
  336. }
  337. pfile3.close();
  338. account_no=count;
  339. return account_no;
  340. }
  341. void sav_account(int account_no,char *name,int balance,char *address,int day,int month,int year,int deposit,int withdraw){
  342. ofstream pfile(name);
  343. pfile<<account_no;
  344. pfile<<endl;
  345. pfile<<name;
  346. pfile<<endl;
  347. pfile<<balance;
  348. pfile<<endl;
  349. pfile<<address;
  350. pfile<<endl;
  351. pfile<<day<<"of"<<month<<"-"<<year;
  352. pfile<<endl;
  353. pfile<<deposit;
  354. pfile<<endl;
  355. pfile<<withdraw;
  356. pfile.close();
  357. update_main(name);
  358. }
  359. void update_main(char *name){
  360. ofstream pfile;
  361. pfile.open("main",ios::app);
  362. pfile<<endl;
  363. pfile<<name;
  364. pfile.close();
  365. }
  366. void new_account_gui(void)
  367. {
  368. int dr=9,mode=2;
  369. initgraph(&dr,&mode,"..\\bgi");
  370. setfillstyle(SOLID_FILL,LIGHTGRAY);
  371. setcolor(DARKGRAY);
  372. rectangle(1,1,640,480);
  373. floodfill(3,3,DARKGRAY);
  374. setcolor(WHITE);
  375. line(1,1,1,480);
  376. line(1,1,640,1);
  377. setcolor(BLUE);
  378. rectangle(3,3,637,15);
  379. setfillstyle(SOLID_FILL,BLUE);
  380. floodfill(5,5,BLUE);
  381. setcolor(DARKGRAY);
  382. rectangle(620,4,635,14);
  383. rectangle(602,4,617,14);
  384. rectangle(585,4,599,14);
  385. setfillstyle(SOLID_FILL,LIGHTGRAY);
  386. floodfill(586,6,DARKGRAY);
  387. floodfill(604,6,DARKGRAY);
  388. floodfill(624,6,DARKGRAY);
  389. setcolor(BLACK);
  390. line(622,6,633,12);
  391. line(633,6,622,12);
  392. rectangle(604,6,615,12);
  393. line(587,12,597,12);
  394. setcolor(WHITE);
  395. line(620,4,620,14);
  396. line(620,4,635,4);
  397. line(602,4,617,4);
  398. line(602,4,602,14);
  399. line(584,4,599,4);
  400. line(584,4,584,14);
  401. outtextxy(8,5,"BANKING SYSTEM");
  402. setcolor(WHITE);
  403. line(5,30,635,30);
  404. line(5,60,635,60);
  405. setcolor(DARKGRAY);
  406. line(5,29,635,29);
  407. line(5,59,635,59);
  408. setcolor(DARKGRAY);
  409. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  410. rectangle(10,70,200,100);
  411. outtextxy(20,80,"N E W A C C O U N T");
  412. setcolor(WHITE);
  413. line(9,70,9,100);
  414. line(10,69,200,69);
  415. setcolor(DARKGRAY);
  416. rectangle(10,110,500,400);
  417. setcolor(WHITE);
  418. line(11,111,11,399);
  419. line(11,111,499,111);
  420. setcolor(DARKGRAY);
  421. outtextxy(40,130,"ACCOUNT NO DATED ");
  422. setcolor(DARKGRAY);
  423. rectangle(130,125,200,150);
  424. rectangle(310,125,450,150);
  425. setcolor(WHITE);
  426. line(199,149,131,149);
  427. line(199,149,199,126);
  428. line(449,149,311,149);
  429. line(449,149,449,126);
  430. setcolor(DARKGRAY);
  431. line(130,125,130,150);
  432. line(130,125,200,125);
  433. line(310,125,310,150);
  434. line(310,125,450,125);
  435.  
  436. line(30,160,470,160);
  437. setcolor(WHITE);
  438. line(30,161,470,161);
  439. setcolor(DARKGRAY);
  440. outtextxy(30,200,"Enter your name (10 char max)");
  441. outtextxy(30,270,"Enter your balance (1000 min)");
  442. outtextxy(30,340,"Enter your address (25 char max)");
  443. setcolor(WHITE);
  444. rectangle(300,190,470,210);
  445. setfillstyle(SOLID_FILL,WHITE);
  446. floodfill(310,195,WHITE);
  447. line(472,212,472,189);
  448. line(472,212,299,212);
  449. setcolor(DARKGRAY);
  450. line(300,190,300,210);
  451. line(300,190,470,190);
  452. line(299,189,299,211);
  453. line(299,189,471,189);
  454. setcolor(WHITE);
  455. rectangle(300,260,470,280);
  456. setfillstyle(SOLID_FILL,WHITE);
  457. floodfill(310,265,WHITE);
  458. line(472,282,472,259);
  459. line(472,282,299,282);
  460. setcolor(DARKGRAY);
  461. line(300,260,300,280);
  462. line(300,260,470,260);
  463. line(299,259,299,281);
  464. line(299,259,471,259);
  465. setcolor(WHITE);
  466. rectangle(300,330,470,350);
  467. setfillstyle(SOLID_FILL,WHITE);
  468. floodfill(310,335,WHITE);
  469. line(472,352,472,329);
  470. line(472,352,299,352);
  471. setcolor(DARKGRAY);
  472. line(300,330,300,350);
  473. line(300,330,470,330);
  474. line(299,329,299,351);
  475. line(299,329,471,329);
  476. }
  477. void list_all(void){
  478. struct date d;
  479. getdate(&d);
  480. list_all_gui();
  481. ifstream pfile("main");
  482. int count=0;
  483. char string[10];
  484. while(string[0]!=NULL){
  485. pfile>>string;
  486. ++count;
  487. }
  488. --count;
  489. pfile.close();
  490. ifstream pfile2("main");
  491. for(int var=count;var>0;--var)
  492. {
  493. pfile2>>string;
  494. if((var!=count)&&(string!=NULL))
  495. print_it(string);
  496. }
  497. pfile2.close();
  498.  
  499. gotoxy(80,25);
  500. getch();
  501. cleardevice();
  502. closegraph();
  503. process();
  504. }
  505. void print_it(char *name){
  506. static value=0;
  507. char address[25];
  508. char account_no[5];
  509. char balance[5];
  510. char withdraw[30];
  511. char date[20];
  512. char deposit[30];
  513. ifstream pfile(name);
  514. pfile>>account_no;
  515. pfile>>name;
  516. pfile>>balance;
  517. pfile>>address;
  518. pfile>>date;
  519. pfile>>deposit;
  520. pfile>>withdraw;
  521. pfile.close();
  522. gotoxy(6,10+value);
  523. cout<<"#";
  524. gotoxy(10,value+10);
  525. cout<<account_no;
  526. gotoxy(14,value+10);
  527. cout<<name;
  528. gotoxy(25,value+10);
  529. cout<<balance;
  530. gotoxy(35,value+10);
  531. cout<<address;
  532. gotoxy(50,value+10);
  533. cout<<date;
  534. ++value;
  535. }
  536. void list_all_gui(void){
  537. int dr=9,mode=2;
  538. initgraph(&dr,&mode,"..\\bgi");
  539. setfillstyle(SOLID_FILL,LIGHTGRAY);
  540. setcolor(DARKGRAY);
  541. rectangle(1,1,640,480);
  542. floodfill(3,3,DARKGRAY);
  543. setcolor(WHITE);
  544. line(1,1,1,480);
  545. line(1,1,640,1);
  546. setcolor(BLUE);
  547. rectangle(3,3,637,15);
  548. setfillstyle(SOLID_FILL,BLUE);
  549. floodfill(5,5,BLUE);
  550. setcolor(DARKGRAY);
  551. rectangle(620,4,635,14);
  552. rectangle(602,4,617,14);
  553. rectangle(585,4,599,14);
  554. setfillstyle(SOLID_FILL,LIGHTGRAY);
  555. floodfill(586,6,DARKGRAY);
  556. floodfill(604,6,DARKGRAY);
  557. floodfill(624,6,DARKGRAY);
  558. setcolor(BLACK);
  559. line(622,6,633,12);
  560. line(633,6,622,12);
  561. rectangle(604,6,615,12);
  562. line(587,12,597,12);
  563. setcolor(WHITE);
  564. line(620,4,620,14);
  565. line(620,4,635,4);
  566. line(602,4,617,4);
  567. line(602,4,602,14);
  568. line(584,4,599,4);
  569. line(584,4,584,14);
  570. outtextxy(8,5,"BANKING SYSTEM");
  571. setcolor(WHITE);
  572. line(5,30,635,30);
  573. line(5,60,635,60);
  574. setcolor(DARKGRAY);
  575. line(5,29,635,29);
  576. line(5,59,635,59);
  577. setcolor(DARKGRAY);
  578. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  579. rectangle(10,70,300,100);
  580. setcolor(WHITE);
  581. line(9,69,9,100);
  582. line(10,69,300,69);
  583. setcolor(DARKGRAY);
  584. outtextxy(30,80,"A C C O U N T L I S T I N G S");
  585. setcolor(WHITE);
  586. rectangle(30,110,610,450);
  587. setfillstyle(SOLID_FILL,WHITE);
  588. floodfill(35,115,WHITE);
  589. line(612,452,612,109);
  590. line(612,452,29,452);
  591. setcolor(DARKGRAY);
  592. line(30,110,30,450);
  593. line(30,110,610,110);
  594. line(29,110,29,450);
  595. line(29,109,610,109);
  596. }
  597. void trans_menu(void)
  598. {
  599. int check;
  600. check=trans_gui();
  601.  
  602. if(check==1)
  603. {
  604. show_trans();
  605. see_it();
  606. }
  607. if(check==2)
  608. {
  609. mod_choice();
  610. }
  611. getch();
  612. cleardevice();
  613. closegraph();
  614. process();
  615. }
  616. int trans_gui(void){
  617. int dr=9,mode=2,option;
  618. initgraph(&dr,&mode,"..\\bgi");
  619. void *main_menu,*button_down;
  620. int size;
  621. size=imagesize(10,110,251,201);
  622. main_menu=malloc(size);
  623. size=imagesize(10,310,251,351);
  624. button_down=malloc(size);
  625. setfillstyle(SOLID_FILL,LIGHTGRAY);
  626. setcolor(DARKGRAY);
  627. rectangle(1,1,640,480);
  628. floodfill(3,3,DARKGRAY);
  629. setcolor(WHITE);
  630. line(1,1,1,480);
  631. line(1,1,640,1);
  632. setcolor(BLUE);
  633. rectangle(3,3,637,15);
  634. setfillstyle(SOLID_FILL,BLUE);
  635. floodfill(5,5,BLUE);
  636. setcolor(DARKGRAY);
  637. rectangle(620,4,635,14);
  638. rectangle(602,4,617,14);
  639. rectangle(585,4,599,14);
  640. setfillstyle(SOLID_FILL,LIGHTGRAY);
  641. floodfill(586,6,DARKGRAY);
  642. floodfill(604,6,DARKGRAY);
  643. floodfill(624,6,DARKGRAY);
  644. setcolor(BLACK);
  645. line(622,6,633,12);
  646. line(633,6,622,12);
  647. rectangle(604,6,615,12);
  648. line(587,12,597,12);
  649. setcolor(WHITE);
  650. line(620,4,620,14);
  651. line(620,4,635,4);
  652. line(602,4,617,4);
  653. line(602,4,602,14);
  654. line(584,4,599,4);
  655. line(584,4,584,14);
  656. outtextxy(8,5,"BANKING SYSTEM");
  657. setcolor(WHITE);
  658. line(5,30,635,30);
  659. line(5,60,635,60);
  660. setcolor(DARKGRAY);
  661. line(5,29,635,29);
  662. line(5,59,635,59);
  663. setcolor(DARKGRAY);
  664. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  665. rectangle(10,70,300,100);
  666. setcolor(WHITE);
  667. line(9,69,9,100);
  668. line(10,69,300,69);
  669. setcolor(DARKGRAY);
  670. outtextxy(30,80," ACCOUNT TRANSACTION MENU");
  671. setcolor(DARKGRAY);
  672. rectangle(10,110,250,150);
  673. setcolor(BLACK);
  674. rectangle(10,110,251,151);
  675. setcolor(WHITE);
  676. line(10,110,10,150);
  677. line(10,110,250,110);
  678. setcolor(BLACK);
  679. outtextxy(40,130,"1. View transaction");
  680. setcolor(DARKGRAY);
  681. rectangle(10,160,250,200);
  682. setcolor(BLACK);
  683. rectangle(10,160,251,201);
  684. setcolor(WHITE);
  685. line(10,160,10,200);
  686. line(10,160,250,160);
  687. setcolor(BLACK);
  688. outtextxy(40,180,"2. Modify transaction");
  689. getimage(10,110,251,201,main_menu);
  690.  
  691. setcolor(WHITE);
  692. rectangle(10,310,251,351);
  693. setcolor(DARKGRAY);
  694. line(10,310,10,350);
  695. line(11,311,11,350);
  696. line(10,310,250,310);
  697. line(11,311,250,311);
  698. setcolor(BLACK);
  699. getimage(10,310,251,351,button_down);
  700. rectangle(10,310,251,351);
  701. setfillstyle(SOLID_FILL,LIGHTGRAY);
  702. floodfill(15,315,BLACK);
  703.  
  704. setcolor(LIGHTGRAY);
  705. rectangle(10,310,251,351);
  706. setcolor(BLACK);
  707. char check;
  708. check=getch();
  709. if(check==49)
  710. {
  711. putimage(10,110,main_menu,COPY_PUT);
  712. putimage(10,110,button_down,COPY_PUT);
  713. outtextxy(40,130,"1. View transaction");
  714. option=1;
  715. delay(600);
  716. }
  717. if(check==50)
  718. {
  719. putimage(10,110,main_menu,COPY_PUT);
  720. putimage(10,160,button_down,COPY_PUT);
  721. outtextxy(40,180,"2. Modify transaction");
  722. option=2;
  723. delay(600);
  724. }
  725. free(main_menu);
  726. free(button_down);
  727. cleardevice();
  728. closegraph();
  729. return(option);
  730. }
  731. void show_trans(void)
  732. {
  733. int dr=9,mode=2;
  734. initgraph(&dr,&mode,"..\\bgi");
  735. setfillstyle(SOLID_FILL,LIGHTGRAY);
  736. setcolor(DARKGRAY);
  737. rectangle(1,1,640,480);
  738. floodfill(3,3,DARKGRAY);
  739. setcolor(WHITE);
  740. line(1,1,1,480);
  741. line(1,1,640,1);
  742. setcolor(BLUE);
  743. rectangle(3,3,637,15);
  744. setfillstyle(SOLID_FILL,BLUE);
  745. floodfill(5,5,BLUE);
  746. setcolor(DARKGRAY);
  747. rectangle(620,4,635,14);
  748. rectangle(602,4,617,14);
  749. rectangle(585,4,599,14);
  750. setfillstyle(SOLID_FILL,LIGHTGRAY);
  751. floodfill(586,6,DARKGRAY);
  752. floodfill(604,6,DARKGRAY);
  753. floodfill(624,6,DARKGRAY);
  754. setcolor(BLACK);
  755. line(622,6,633,12);
  756. line(633,6,622,12);
  757. rectangle(604,6,615,12);
  758. line(587,12,597,12);
  759. setcolor(WHITE);
  760. line(620,4,620,14);
  761. line(620,4,635,4);
  762. line(602,4,617,4);
  763. line(602,4,602,14);
  764. line(584,4,599,4);
  765. line(584,4,584,14);
  766. outtextxy(8,5,"BANKING SYSTEM");
  767. setcolor(WHITE);
  768. line(5,30,635,30);
  769. line(5,60,635,60);
  770. setcolor(DARKGRAY);
  771. line(5,29,635,29);
  772. line(5,59,635,59);
  773. setcolor(DARKGRAY);
  774. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  775. rectangle(10,70,200,100);
  776. outtextxy(20,80,"SHOW TRANSACTION");
  777. setcolor(WHITE);
  778. line(9,70,9,100);
  779. line(10,69,200,69);
  780. setcolor(DARKGRAY);
  781. line(30,170,610,170);
  782. setcolor(WHITE);
  783. line(30,171,610,171);
  784. setcolor(DARKGRAY);
  785. outtextxy(30,200,"Enter your account holder's name");
  786. setcolor(WHITE);
  787. rectangle(300,190,470,210);
  788. setfillstyle(SOLID_FILL,WHITE);
  789. floodfill(310,195,WHITE);
  790. line(472,212,472,189);
  791. line(472,212,299,212);
  792. setcolor(DARKGRAY);
  793. line(300,190,300,210);
  794. line(300,190,470,190);
  795. line(299,189,299,211);
  796. line(299,189,471,189);
  797. }
  798. void mod_trans(void)
  799. {
  800. int dr=9,mode=2;
  801. initgraph(&dr,&mode,"..\\bgi");
  802. setfillstyle(SOLID_FILL,LIGHTGRAY);
  803. setcolor(DARKGRAY);
  804. rectangle(1,1,640,480);
  805. floodfill(3,3,DARKGRAY);
  806. setcolor(WHITE);
  807. line(1,1,1,480);
  808. line(1,1,640,1);
  809. setcolor(BLUE);
  810. rectangle(3,3,637,15);
  811. setfillstyle(SOLID_FILL,BLUE);
  812. floodfill(5,5,BLUE);
  813. setcolor(DARKGRAY);
  814. rectangle(620,4,635,14);
  815. rectangle(602,4,617,14);
  816. rectangle(585,4,599,14);
  817. setfillstyle(SOLID_FILL,LIGHTGRAY);
  818. floodfill(586,6,DARKGRAY);
  819. floodfill(604,6,DARKGRAY);
  820. floodfill(624,6,DARKGRAY);
  821. setcolor(BLACK);
  822. line(622,6,633,12);
  823. line(633,6,622,12);
  824. rectangle(604,6,615,12);
  825. line(587,12,597,12);
  826. setcolor(WHITE);
  827. line(620,4,620,14);
  828. line(620,4,635,4);
  829. line(602,4,617,4);
  830. line(602,4,602,14);
  831. line(584,4,599,4);
  832. line(584,4,584,14);
  833. outtextxy(8,5,"BANKING SYSTEM");
  834. setcolor(WHITE);
  835. line(5,30,635,30);
  836. line(5,60,635,60);
  837. setcolor(DARKGRAY);
  838. line(5,29,635,29);
  839. line(5,59,635,59);
  840. setcolor(DARKGRAY);
  841. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  842. rectangle(10,70,200,100);
  843. outtextxy(20,80,"MODIFY ACCOUNT");
  844. setcolor(WHITE);
  845. line(9,70,9,100);
  846. line(10,69,200,69);
  847. setcolor(DARKGRAY);
  848. line(30,170,610,170);
  849. setcolor(WHITE);
  850. line(30,171,610,171);
  851. setcolor(DARKGRAY);
  852. outtextxy(30,200,"Enter your account holder's name");
  853. setcolor(WHITE);
  854. rectangle(300,190,470,210);
  855. setfillstyle(SOLID_FILL,WHITE);
  856. floodfill(310,195,WHITE);
  857. line(472,212,472,189);
  858. line(472,212,299,212);
  859. setcolor(DARKGRAY);
  860. line(300,190,300,210);
  861. line(300,190,470,190);
  862. line(299,189,299,211);
  863. line(299,189,471,189);
  864. }
  865. void see_it(void){
  866. char name[10];
  867. char address[25];
  868. char account_no[5];
  869. char balance[5];
  870. char withdraw[30];
  871. char date[20];
  872. char deposit[30];
  873. gotoxy(40,13);
  874. cout<<" ";
  875. cin>>name;
  876. ifstream pfile(name);
  877. pfile>>account_no;
  878. pfile>>name;
  879. pfile>>balance;
  880. pfile>>address;
  881. pfile>>date;
  882. pfile>>deposit;
  883. pfile>>withdraw;
  884. pfile.close();
  885. report();
  886. gotoxy(20,10);
  887. cout<<"ACCOUNT HOLDER NAME: "<<name<<endl;
  888. gotoxy(20,11);
  889. cout<<"DATE OF ISSUE: "<<date<<endl;
  890. gotoxy(20,12);
  891. cout<<"BALANCE LEFT: "<<balance<<endl;
  892. gotoxy(20,13);
  893. cout<<"ADDRESS: "<<address<<endl;
  894. cout<<endl;
  895. gotoxy(20,15);
  896. cout<<"TRANSACTION REPORT"<<endl;
  897. gotoxy(20,16);
  898. cout<<"DEPOSIT REPORT: "<<deposit<<endl;
  899. gotoxy(20,17);
  900. cout<<"WITH DRAW REPORT: "<<withdraw<<endl;
  901. }
  902. void report(void)
  903. {
  904. int dr=9,mode=2;
  905. initgraph(&dr,&mode,"..\\bgi");
  906. setfillstyle(SOLID_FILL,LIGHTGRAY);
  907. setcolor(DARKGRAY);
  908. rectangle(1,1,640,480);
  909. floodfill(3,3,DARKGRAY);
  910. setcolor(WHITE);
  911. line(1,1,1,480);
  912. line(1,1,640,1);
  913. setcolor(BLUE);
  914. rectangle(3,3,637,15);
  915. setfillstyle(SOLID_FILL,BLUE);
  916. floodfill(5,5,BLUE);
  917. setcolor(DARKGRAY);
  918. rectangle(620,4,635,14);
  919. rectangle(602,4,617,14);
  920. rectangle(585,4,599,14);
  921. setfillstyle(SOLID_FILL,LIGHTGRAY);
  922. floodfill(586,6,DARKGRAY);
  923. floodfill(604,6,DARKGRAY);
  924. floodfill(624,6,DARKGRAY);
  925. setcolor(BLACK);
  926. line(622,6,633,12);
  927. line(633,6,622,12);
  928. rectangle(604,6,615,12);
  929. line(587,12,597,12);
  930. setcolor(WHITE);
  931. line(620,4,620,14);
  932. line(620,4,635,4);
  933. line(602,4,617,4);
  934. line(602,4,602,14);
  935. line(584,4,599,4);
  936. line(584,4,584,14);
  937. outtextxy(8,5,"BANKING SYSTEM");
  938. setcolor(WHITE);
  939. line(5,30,635,30);
  940. line(5,60,635,60);
  941. setcolor(DARKGRAY);
  942. line(5,29,635,29);
  943. line(5,59,635,59);
  944. setcolor(DARKGRAY);
  945. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  946. rectangle(10,70,300,100);
  947. setcolor(WHITE);
  948. line(9,69,9,100);
  949. line(10,69,300,69);
  950. setcolor(DARKGRAY);
  951. outtextxy(30,80,"TRANSACTION REPORT");
  952. setcolor(WHITE);
  953. rectangle(30,110,610,450);
  954. setfillstyle(SOLID_FILL,WHITE);
  955. floodfill(35,115,WHITE);
  956. line(612,452,612,109);
  957. line(612,452,29,452);
  958. setcolor(DARKGRAY);
  959. line(30,110,30,450);
  960. line(30,110,610,110);
  961. line(29,110,29,450);
  962. line(29,109,610,109);
  963. }
  964. void deposite(void){
  965. char name[10];
  966. gotoxy(40,13);
  967. cout<<" ";
  968. cin>>name;
  969. int val_dep;
  970. char tmp_dep[5];
  971. char address[25];
  972. char dat[10];
  973. char deposit[30];
  974. char withdraw[40];
  975. int account_no;
  976. int balance;
  977. ifstream pfile(name);
  978. pfile>>account_no;
  979. pfile>>name;
  980. pfile>>balance;
  981. pfile>>address;
  982. pfile>>dat;
  983. pfile>>deposit;
  984. pfile>>withdraw;
  985. dep_gui();
  986. gotoxy(5,8);
  987. cout<<account_no<<name<<balance<<dat<<deposit<<address<<withdraw<<endl;
  988. pfile.close();
  989. strcat(deposit,"#");
  990. gotoxy(40,13);
  991. cout<<" ";
  992. cin>>tmp_dep;
  993. strcat(deposit,tmp_dep);
  994. val_dep=atoi(tmp_dep);
  995. balance+=val_dep;
  996. ofstream pfile2(name);
  997. pfile2<<account_no<<endl;
  998. pfile2<<name<<endl;
  999. pfile2<<balance<<endl;
  1000. pfile2<<address<<endl;
  1001. pfile2<<dat<<endl;
  1002. pfile2<<deposit<<endl;
  1003. pfile2<<withdraw;
  1004. pfile2.close();
  1005. cleardevice();
  1006. closegraph();
  1007. process();
  1008. }
  1009. void dep_gui(void)
  1010. {
  1011. int dr=9,mode=2;
  1012. initgraph(&dr,&mode,"..\\bgi");
  1013. setfillstyle(SOLID_FILL,LIGHTGRAY);
  1014. setcolor(DARKGRAY);
  1015. rectangle(1,1,640,480);
  1016. floodfill(3,3,DARKGRAY);
  1017. setcolor(WHITE);
  1018. line(1,1,1,480);
  1019. line(1,1,640,1);
  1020. setcolor(BLUE);
  1021. rectangle(3,3,637,15);
  1022. setfillstyle(SOLID_FILL,BLUE);
  1023. floodfill(5,5,BLUE);
  1024. setcolor(DARKGRAY);
  1025. rectangle(620,4,635,14);
  1026. rectangle(602,4,617,14);
  1027. rectangle(585,4,599,14);
  1028. setfillstyle(SOLID_FILL,LIGHTGRAY);
  1029. floodfill(586,6,DARKGRAY);
  1030. floodfill(604,6,DARKGRAY);
  1031. floodfill(624,6,DARKGRAY);
  1032. setcolor(BLACK);
  1033. line(622,6,633,12);
  1034. line(633,6,622,12);
  1035. rectangle(604,6,615,12);
  1036. line(587,12,597,12);
  1037. setcolor(WHITE);
  1038. line(620,4,620,14);
  1039. line(620,4,635,4);
  1040. line(602,4,617,4);
  1041. line(602,4,602,14);
  1042. line(584,4,599,4);
  1043. line(584,4,584,14);
  1044. outtextxy(8,5,"BANKING SYSTEM");
  1045. setcolor(WHITE);
  1046. line(5,30,635,30);
  1047. line(5,60,635,60);
  1048. setcolor(DARKGRAY);
  1049. line(5,29,635,29);
  1050. line(5,59,635,59);
  1051. setcolor(DARKGRAY);
  1052. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  1053. rectangle(10,70,200,100);
  1054. outtextxy(20,80,"MODIFY ACCOUNT");
  1055. setcolor(WHITE);
  1056. rectangle(30,110,610,130);
  1057. setfillstyle(SOLID_FILL,WHITE);
  1058. floodfill(310,115,WHITE);
  1059. line(612,132,612,109);
  1060. line(612,132,29,132);
  1061. setcolor(DARKGRAY);
  1062. line(30,110,30,130);
  1063. line(30,110,610,110);
  1064. line(29,109,29,131);
  1065. line(29,109,611,109);
  1066. setcolor(WHITE);
  1067. line(9,70,9,100);
  1068. line(10,69,200,69);
  1069. setcolor(DARKGRAY);
  1070. line(30,170,610,170);
  1071. setcolor(WHITE);
  1072. line(30,171,610,171);
  1073. setcolor(DARKGRAY);
  1074. outtextxy(30,200,"Enter the amount to deposite");
  1075. setcolor(WHITE);
  1076. rectangle(300,190,470,210);
  1077. setfillstyle(SOLID_FILL,WHITE);
  1078. floodfill(310,195,WHITE);
  1079. line(472,212,472,189);
  1080. line(472,212,299,212);
  1081. setcolor(DARKGRAY);
  1082. line(300,190,300,210);
  1083. line(300,190,470,190);
  1084. line(299,189,299,211);
  1085. line(299,189,471,189);
  1086. }
  1087. int mod_menu(void)
  1088. {
  1089. int dr=9,mode=2;
  1090. initgraph(&dr,&mode,"..\\bgi");
  1091. void *main_menu,*button_down;
  1092. int size;
  1093. size=imagesize(10,110,251,201);
  1094. main_menu=malloc(size);
  1095. size=imagesize(10,310,251,351);
  1096. button_down=malloc(size);
  1097. setfillstyle(SOLID_FILL,LIGHTGRAY);
  1098. setcolor(DARKGRAY);
  1099. rectangle(1,1,640,480);
  1100. floodfill(3,3,DARKGRAY);
  1101. setcolor(WHITE);
  1102. line(1,1,1,480);
  1103. line(1,1,640,1);
  1104. setcolor(BLUE);
  1105. rectangle(3,3,637,15);
  1106. setfillstyle(SOLID_FILL,BLUE);
  1107. floodfill(5,5,BLUE);
  1108. setcolor(DARKGRAY);
  1109. rectangle(620,4,635,14);
  1110. rectangle(602,4,617,14);
  1111. rectangle(585,4,599,14);
  1112. setfillstyle(SOLID_FILL,LIGHTGRAY);
  1113. floodfill(586,6,DARKGRAY);
  1114. floodfill(604,6,DARKGRAY);
  1115. floodfill(624,6,DARKGRAY);
  1116. setcolor(BLACK);
  1117. line(622,6,633,12);
  1118. line(633,6,622,12);
  1119. rectangle(604,6,615,12);
  1120. line(587,12,597,12);
  1121. setcolor(WHITE);
  1122. line(620,4,620,14);
  1123. line(620,4,635,4);
  1124. line(602,4,617,4);
  1125. line(602,4,602,14);
  1126. line(584,4,599,4);
  1127. line(584,4,584,14);
  1128. outtextxy(8,5,"BANKING SYSTEM");
  1129. setcolor(WHITE);
  1130. line(5,30,635,30);
  1131. line(5,60,635,60);
  1132. setcolor(DARKGRAY);
  1133. line(5,29,635,29);
  1134. line(5,59,635,59);
  1135. setcolor(DARKGRAY);
  1136. outtextxy(40,40,"B A N K I N G S Y S T E M designed for national bank of pakistan");
  1137. rectangle(10,70,300,100);
  1138. setcolor(WHITE);
  1139. line(9,69,9,100);
  1140. line(10,69,300,69);
  1141. setcolor(DARKGRAY);
  1142. outtextxy(30,80,"MODIFY ACCOUNT");
  1143. setcolor(DARKGRAY);
  1144. rectangle(10,110,250,150);
  1145. setcolor(BLACK);
  1146. rectangle(10,110,251,151);
  1147. setcolor(WHITE);
  1148. line(10,110,10,150);
  1149. line(10,110,250,110);
  1150. setcolor(BLACK);
  1151. outtextxy(40,130,"1. Want to deposite");
  1152. setcolor(DARKGRAY);
  1153. rectangle(10,160,250,200);
  1154. setcolor(BLACK);
  1155. rectangle(10,160,251,201);
  1156. setcolor(WHITE);
  1157. line(10,160,10,200);
  1158. line(10,160,250,160);
  1159. setcolor(BLACK);
  1160. outtextxy(40,180,"2. Want to withdraw");
  1161. getimage(10,110,251,201,main_menu);
  1162.  
  1163. setcolor(WHITE);
  1164. rectangle(10,310,251,351);
  1165. setcolor(DARKGRAY);
  1166. line(10,310,10,350);
  1167. line(11,311,11,350);
  1168. line(10,310,250,310);
  1169. line(11,311,250,311);
  1170. setcolor(BLACK);
  1171. getimage(10,310,251,351,button_down);
  1172. rectangle(10,310,251,351);
  1173. setfillstyle(SOLID_FILL,LIGHTGRAY);
  1174. floodfill(15,315,BLACK);
  1175. int option;
  1176. setcolor(LIGHTGRAY);
  1177. rectangle(10,310,251,351);
  1178. setcolor(BLACK);
  1179. char check;
  1180. check=getch();
  1181. if(check==49)
  1182. {
  1183. putimage(10,110,main_menu,COPY_PUT);
  1184. putimage(10,110,button_down,COPY_PUT);
  1185. outtextxy(40,130,"1. Want to deposite");
  1186. option=1;
  1187. delay(600);
  1188. }
  1189. if(check==50)
  1190. {
  1191. putimage(10,110,main_menu,COPY_PUT);
  1192. putimage(10,160,button_down,COPY_PUT);
  1193. outtextxy(40,180,"2. Want to withdraw");
  1194. option=2;
  1195. delay(600);
  1196. }
  1197. free(main_menu);
  1198. free(button_down);
  1199. return(option);
  1200. }
  1201. void mod_choice(void)
  1202. {
  1203. int check;
  1204. check=mod_menu();
  1205. if(check==1)
  1206. {
  1207. mod_trans();
  1208. deposite();
  1209. }
  1210. if(check==2)
  1211. {
  1212. mod_trans();
  1213. withdraw();
  1214. }
  1215. }
  1216. void withdraw(void){
  1217. int tmp;
  1218. char name[10];
  1219. char tmp_with[10];
  1220. char address[25];
  1221. char dat[10];
  1222. char deposit[40];
  1223. char withdraw[40];
  1224. int account_no;
  1225. int balance;
  1226. gotoxy(40,13);
  1227. cout<<" ";
  1228. cin>>name;
  1229. ifstream pfile(name);
  1230. pfile>>account_no;
  1231. pfile>>name;
  1232. pfile>>balance;
  1233. pfile>>address;
  1234. pfile>>dat;
  1235. pfile>>deposit;
  1236. pfile>>withdraw;
  1237. withdraw[0]=32;
  1238. cout<<account_no<<name<<balance<<dat<<deposit<<address<<withdraw<<endl;
  1239. pfile.close();
  1240. strcat(withdraw,"#");
  1241. gotoxy(40,13);
  1242. cout<<" ";
  1243. cin>>tmp;
  1244. itoa(tmp,tmp_with,10);
  1245. strcat(withdraw,tmp_with);
  1246. balance-=tmp;
  1247. ofstream pfile2(name);
  1248. pfile2<<account_no<<endl;
  1249. pfile2<<name<<endl;
  1250. pfile2<<balance<<endl;
  1251. pfile2<<address<<endl;
  1252. pfile2<<dat<<endl;
  1253. pfile2<<deposit<<endl;
  1254. pfile2<<withdraw;
  1255. pfile2.close();
  1256. cleardevice();
  1257. closegraph();
  1258. process();
  1259. }

Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC