scientific calculator online

Hello every one, I wanna present my project. As the subject implies, its a scientific calculator online at http://www.tehksoft.net. I tried to make the input expressions as similar as possible to real mathematical expressions. It has almost if not all scientific functions you expect. So if you happen to use it, please give a feedback. link again: http://www.tehksoft.net
Submitted byAnonymous (not verified)on Tue, 09/21/2010 - 10:00

Please, I need help,, I need a code for scientific calculator system using c++.....
Submitted byAnonymous (not verified)on Wed, 10/13/2010 - 22:37

In reply to by Anonymous (not verified)

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

plz,i need help....i need a code for scientific calculator system using java

Add new comment