Note - Double Click to Copy Code Contact Us!

Loan Management system using C++

Tech Doubility
Loan Management system using C++



  1. /* This file contains the main code */
  2.  
  3. #include<iostream.h>
  4. #include<fstream.h>
  5. #include<stdio.h>
  6. #include<iomanip.h>
  7. #include<stdlib.h>
  8. #include<conio.h>
  9. #include<string.h>
  10. #include<dir.h>
  11. #include<dos.h>
  12. #include<bios.h>
  13. #include<graphics.h>
  14.  
  15. void screen();
  16. void drawdoublelinebox(int,int,int,int);
  17. void drawsinglelinebox(int,int,int,int);
  18. void normal();
  19.  
  20.  
  21. #define datafile "E.txt"
  22. #define recsize 78
  23. #define max 59
  24. #define bucketsize 3
  25. int hash(char a[]);
  26. fstream file;
  27. char buffer[100];
  28.  
  29. class Loan
  30. {
  31. public:
  32. char account_no[12],bank_id[10],cust_name[12],phone[12],occupation[7],loan_type[7],branch_id[8],ROI[5];
  33. public:
  34. void initial();
  35. void read();
  36. void pack();
  37. void unpack();
  38. int retrieve(int addr,char k[],int i);
  39. void datadisp();
  40. int remove(int addr,char k[]);
  41. void modify(int addr ,char k[]);
  42. };
  43.  
  44. int myatoi(char *k)
  45. {
  46. int res=0;
  47. for(int i=0;k[i]!='\0';++i)
  48. {
  49. if(k[i]==58)
  50. continue;
  51. res=res*10+k[i]-48;
  52. }
  53. //cout<<res;
  54. return res;
  55. }
  56.  
  57. void opener(fstream &file,char *fn,int mode)
  58. {
  59. file.open(fn,mode);
  60. if(!file)
  61. {
  62. cout<<"UNABLE TO OPEN THE FILE\n"<<fn;
  63. getch();
  64. exit(1);
  65. }
  66. }
  67.  
  68. void Loan::initial()
  69. {
  70. int i,j;
  71. file.open(datafile,ios::in);
  72. if(!file)
  73. {
  74. file.open(datafile,ios::out);
  75. if(!file)
  76. {
  77. cout<<"UNABLE TO OPEN THE FILE\n";
  78. getch();
  79. exit(1);
  80. }
  81. for(i=0;i<max;i++)
  82. {
  83. file.seekp(i*recsize*3,ios::beg);
  84. for(j=0;j<(recsize*3)-2;j++)
  85. file<<"#";
  86. file<<endl;
  87. }
  88. cout<<"EMPTY FILE CREATED\n";
  89. }
  90. file.close();
  91. return;
  92. }
  93. void Loan::read()
  94. {
  95. int addr,len,len1,len2,len3,len4,len5;
  96. char acc_no[12],dbank_id[10],dbranch_id[8];
  97.  
  98. LABEL:
  99. cout<<"\n\t\t\tENTER THE ACCOUNT NUMBER: ";
  100. gets(acc_no);
  101. len=strlen(acc_no);
  102. addr=hash(acc_no);
  103. if(len!=8)
  104. {
  105. cout<<"\n\t ENTER THE VALID ACCOUNT NUMBER(8 CHARACTERS): ";
  106. goto LABEL;
  107. }
  108.  
  109. if(retrieve(addr,acc_no,0)>0)
  110. {
  111. cout<<"!!*** ACCOUNT NUMBER IS ALREADY PRESENT, WE CANNOT ADD IT TO THE HASH FILE ***!!\n";
  112. goto LABEL;
  113. }
  114. file.close();
  115. strcpy(account_no,acc_no);
  116.  
  117. DESC:
  118. cout<<"\n\t\t\tENTER BANK ID: ";
  119. gets(dbank_id);
  120. len1=strlen(dbank_id);
  121. if(len1!=8||dbank_id[0]>63||dbank_id[1]<63||dbank_id[2]<63||dbank_id[3]<63 ||dbank_id[4]<63 ||dbank_id[5]<63||dbank_id[6]<63||dbank_id[7]<63||dbank_id[8]>63)
  122. {
  123. cout<<"\n\t ENTER THE VALID BANK ID(8 CHARACTERS): ";
  124. goto DESC;
  125. }
  126. file.close();
  127. strcpy(bank_id,dbank_id);
  128.  
  129. NAME:
  130. cout<<"\n\t\t\tENTER THE CUSTOMER NAME: ";
  131. gets(cust_name);
  132. int i=0;
  133. while(cust_name[i]!='\0')
  134. {
  135. if(cust_name[i]<63||i>9)
  136. {
  137. cout<<"\n\t ENTER THE VALID CUSTOMER NAME(LESS THAN 10 CHARACTERS): ";
  138. goto NAME;
  139. }
  140. i++;
  141. }
  142.  
  143. PH:
  144. i=0;
  145. cout<<"\n\t\t\tENTER THE PHONE: ";
  146. gets(phone);
  147. len3=strlen(phone);
  148. while(phone[i]!='\0')
  149. {
  150. if(phone[i]>63 ||i>9 ||len3!=10)
  151. {
  152. cout<<"\n\t ENTER VALID PHONE NUMBER: ";
  153. goto PH;
  154. }
  155. i++;
  156. }
  157. /* if(i!=11)
  158. {
  159.   cout<<"\n\t ENTER VALID PHONE NUMBER: ";
  160. goto PH;
  161.  
  162. }*/
  163. OCC:
  164. int ch;
  165. cout<<"\n\t\t\tENTER THE OCCUPATION: \n\t\t\t1.Government\n\t\t\t2.Private\n\t\t\t3.Others\n\t\t\t ";
  166. cin>>ch;
  167. switch(ch){
  168. case 1: strcpy(occupation,"Govt");
  169. break;
  170. case 2: strcpy(occupation,"prvt");
  171. break;
  172. case 3: strcpy(occupation,"others");
  173. break;
  174. default: goto OCC;
  175. }
  176.  
  177. LOAN:
  178. cout<<"\n\t The loan types are:\n ";
  179. cout<<"\n\t\t\t 1.Education loan";
  180. cout<<"\n\t\t\t 2.Home loan";
  181. cout<<"\n\t\t\t 3.Car loan\n";
  182. int chi;
  183. cout<<"\n\t\t\t Enter choice:\t ";
  184. cin>>chi;
  185. if(chi==1)
  186. {
  187. strcpy(loan_type,"Edu");
  188. strcpy(ROI,"10");
  189. }
  190. else if(chi==2)
  191. {
  192. strcpy(loan_type,"Home");
  193. strcpy(ROI,"12");
  194. }
  195. else
  196. {
  197. strcpy(loan_type,"Car");
  198. strcpy(ROI,"18");
  199. }
  200.  
  201.  
  202. BRANCH:
  203. cout<<"\n\t\t\tENTER THE BRANCH ID: ";
  204. gets(dbranch_id);
  205. len2=strlen(dbranch_id);
  206. if(len2!=5)
  207. {
  208. cout<<"\n\t ENTER THE VALID BRANCH ID(5 CHARACTERS): \n";
  209. goto BRANCH;
  210. }
  211. file.close();
  212. strcpy(branch_id,dbranch_id);
  213.  
  214. pack();
  215. return;
  216. }
  217. void Loan::pack()
  218. {
  219. strcpy(buffer,account_no); strcat(buffer,"|");
  220. strcat(buffer,bank_id); strcat(buffer,"|");
  221. strcat(buffer,cust_name); strcat(buffer,"|");
  222. strcat(buffer,phone); strcat(buffer,"|");
  223. strcat(buffer,occupation); strcat(buffer,"|");
  224. strcat(buffer,loan_type); strcat(buffer,"|");
  225. strcat(buffer,branch_id); strcat(buffer,"|");
  226. strcat(buffer,ROI); strcat(buffer,"|");
  227. }
  228.  
  229. int hash(char account_no[])
  230. {
  231. int i=0,sum=0,c,len;
  232. len=strlen(account_no);
  233. if(len%2==1)
  234. len++;
  235. for(i=0;i<len;i++)
  236. sum=(sum+((account_no[i]-48)));
  237. c=sum%max;
  238. cout<<"\n\t\t HASH KEY GENERATED IS: "<<c<<endl;
  239. return c;
  240. }
  241.  
  242. void store(int addr)
  243. {
  244. char dummy[10];
  245. int flag=0,i;
  246. file.open(datafile,ios::in|ios::out);
  247. file.seekg(addr*recsize*bucketsize,ios::beg);
  248. file.getline(dummy,5,'\n');
  249. if(strcmp(dummy,"####")==0 ||strcmp(dummy,"$$$$")==0)
  250. {
  251. file.seekp(addr*recsize*bucketsize,ios::beg);
  252. file<<buffer;
  253. clrscr();
  254. textcolor(YELLOW);
  255. textbackground(BLACK);
  256. cout<<"\n\n\n\n";
  257. for(int q=0;q<80;q++) cout<<'~';
  258. for(int w=0;w<80;w++) cout<<'*';
  259. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  260. for(int e=0;e<80;e++) cout<<'*';
  261. cout<<"\n";
  262. for(int r=0;r<80;r++) cout<<'~';
  263. getch();
  264. flag=1;
  265. }
  266. file.seekg(addr*recsize*bucketsize+recsize,ios::beg);
  267. file.getline(dummy,5,'\n');
  268. if((strcmp(dummy,"####")==0||strcmp(dummy,"$$$$")==0) && flag!=1)
  269. {
  270. file.seekp(addr*recsize*bucketsize+recsize,ios::beg);
  271. file<<buffer;clrscr();
  272. textcolor(YELLOW);
  273. textbackground(BLACK);
  274. cout<<"\n\n\n\n";
  275. for(int q=0;q<80;q++) cout<<'~';
  276. for(int w=0;w<80;w++) cout<<'*';
  277. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  278. for(int e=0;e<80;e++) cout<<'*';
  279. cout<<"\n";
  280. for(int r=0;r<80;r++) cout<<'~';
  281. getch();
  282. flag=1;
  283. }
  284. file.seekg(addr*recsize*bucketsize+(2*recsize),ios::beg);
  285. file.getline(dummy,5,'\n');
  286. if((strcmp(dummy,"####")==0||strcmp(dummy,"$$$$")==0)&&flag!=1)
  287. {
  288. file.seekp(addr*recsize*bucketsize+(2*recsize),ios::beg);
  289. file<<buffer;
  290. clrscr();
  291. textcolor(YELLOW);
  292. textbackground(BLACK);
  293. cout<<"\n\n\n\n";
  294. for(int q=0;q<80;q++) cout<<'~';
  295. for(int w=0;w<80;w++) cout<<'*';
  296. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  297. for(int e=0;e<80;e++) cout<<'*';
  298. cout<<"\n";
  299. for(int r=0;r<80;r++) cout<<'~';
  300. getch();
  301. flag=1;
  302. }
  303. if(flag!=1)
  304. {
  305. for(i=addr+1;i!=addr;i++)
  306. {
  307. if(i%max==0)
  308. i=0;
  309. file.seekg(i*recsize*bucketsize,ios::beg);
  310. file.getline(dummy,5,'\n');
  311. if(strcmp(dummy,"####")==0||strcmp(dummy,"$$$$")==0)
  312. {
  313. clrscr();
  314. textcolor(YELLOW);
  315. textbackground(BLACK);
  316. cout<<"\n\n\n\n";
  317. for(int t=0;t<80;t++) cout<<'~';
  318. for(int y=0;y<80;y++) cout<<'*';
  319. cout<<"\n\n\t\t\tCOLLISION HAS OCCURED....!!\n\n";
  320. cout<<"\t HOME ADDRESS IS: "<<addr<<" & ACTUAL ADDRESS IS: "<<i<<"\n";
  321. file.seekp(i*recsize*bucketsize,ios::beg);
  322. file<<buffer;
  323. textcolor(YELLOW);
  324. textbackground(BLACK);
  325. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  326. for(int u=0;u<80;u++) cout<<'*';
  327. cout<<"\n";
  328. for(int f=0;f<80;f++) cout<<'~';
  329. getch();
  330. flag=1;
  331. break;
  332. }
  333. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  334. file.getline(dummy,5,'\n');
  335. if(strcmp(dummy,"####")==0||strcmp(dummy,"$$$$")==0)
  336. {
  337. clrscr();
  338. textcolor(YELLOW);
  339. textbackground(BLACK);
  340. cout<<"\n\n\n\n";
  341. for(int t=0;t<80;t++) cout<<'~';
  342. for(int y=0;y<80;y++) cout<<'*';
  343. cout<<"\n\n\t\t\tCOLLISION HAS OCCURED....!!\n\n";
  344. cout<<"\t HOME ADDRESS IS: "<<addr<<" & ACTUAL ADDRESS IS: "<<i<<"\n";
  345. file.seekp(i*recsize*bucketsize+recsize,ios::beg);
  346. file<<buffer;
  347. textcolor(YELLOW);
  348. textbackground(BLACK);
  349. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  350. for(int u=0;u<80;u++) cout<<'*';
  351. cout<<"\n";
  352. for(int f=0;f<80;f++) cout<<'~';
  353. getch();
  354. flag=1;
  355. break;
  356. }
  357. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  358. file.getline(dummy,5,'\n');
  359. if(strcmp(dummy,"####")==0||strcmp(dummy,"$$$$")==0)
  360. {
  361. clrscr();
  362. textcolor(YELLOW);
  363. textbackground(BLACK);
  364. cout<<"\n\n\n\n";
  365. for(int t=0;t<80;t++) cout<<'~';
  366. for(int y=0;y<80;y++) cout<<'*';
  367. cout<<"\n\n\t\t\tCOLLISION HAS OCCURED....!!\n\n";
  368. cout<<"\t HOME ADDRESS IS: "<<addr<<" & ACTUAL ADDRESS IS: "<<i<<"\n";
  369. file.seekp(i*recsize*bucketsize+(2*recsize),ios::beg);
  370. file<<buffer;
  371. textcolor(YELLOW);
  372. textbackground(BLACK);
  373. cout<<"\n\n\t\t LOAN RECORD INSERTED SUCCESSFULLY....!!\n\n";
  374. for(int u=0;u<80;u++) cout<<'*';
  375. cout<<"\n";
  376. for(int f=0;f<80;f++) cout<<'~';
  377. getch();
  378. flag=1;
  379. break;
  380. }
  381. }
  382. }
  383. if(i==addr && (flag!=1))
  384. {
  385. clrscr();
  386. textcolor(YELLOW);
  387. textbackground(BLACK);
  388. cout<<"\n\n\n\n";
  389. for(int o=0;o<80;o++) cout<<'~';
  390. for(int a=0;a<80;a++) cout<<'*';
  391. cout<<setw(23)<<" "<<"\n\n\t*** HASH FILE IS FULL, LOAN RECORD CANT BE INSERTED ***\n\n";
  392. for(int s=0;s<80;s++) cout<<'*';
  393. for(int d=0;d<80;d++) cout<<'~';
  394. getch();
  395. }
  396. getch();
  397. file.close();
  398. return;
  399. }
  400.  
  401. void Loan::unpack()
  402. {
  403. char dummy[100];
  404. file.getline(bank_id,10,'|');
  405. file.getline(cust_name,12,'|');
  406. file.getline(phone,12,'|');
  407. file.getline(occupation,7,'|');
  408. file.getline(loan_type,7,'|');
  409. file.getline(branch_id,8,'|');
  410. file.getline(ROI,5,'|');
  411. file.getline(dummy,100,'#');
  412. }
  413.  
  414. int Loan::retrieve(int addr,char k[],int l) //search
  415. {
  416. int found=0,i;
  417. char dummy[10];
  418. i=addr;
  419. file.open(datafile,ios::in);
  420. cout<<setiosflags(ios::left);
  421. //if(l==1)
  422. do
  423. {
  424. file.seekg(i*recsize*bucketsize,ios::beg);
  425. file.getline(dummy,5,'\n');
  426. if(strcmp(dummy,"####")==0)
  427. break;
  428. file.seekg(i*recsize*bucketsize,ios::beg);
  429. file.getline(account_no,10,'|');
  430. if(strcmp(account_no,k)==0)
  431. {
  432. found=1;
  433. if(l==1)
  434. {
  435. unpack();
  436. clrscr();
  437. textcolor(15);
  438. textbackground(YELLOW);
  439. cout<<endl;
  440. cout<<setw(18)<<" "<<"THE SEARCHED LOAN RECORD IS DISPLAYED"<<endl<<endl;
  441. for(int f=0;f<80;f++) cout<<'*'; cout<<endl;
  442. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  443. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  444. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  445. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  446. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  447. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  448. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  449. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  450. for(int g=0;g<80;g++) cout<<'*';
  451. cout<<endl<<setw(25)<<" ";
  452.  
  453. cout<<"LOAN RECORD FOUND...!!"<<endl;
  454. }
  455. break;
  456. }
  457. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  458. file.getline(account_no,10,'|');
  459. if(strcmp(account_no,"#########")==0)
  460. break;
  461. if(strcmp(account_no,k)==0)
  462. {
  463. found=1;
  464. if(l==1)
  465. {
  466. unpack();
  467. clrscr();
  468. textcolor(15);
  469. textbackground(YELLOW);
  470. cout<<endl;
  471. cout<<setw(18)<<" "<<"THE SEARCHED LOAN RECORD IS DISPLAYED"<<endl<<endl;
  472. for(int f=0;f<80;f++) cout<<'*'; cout<<endl;
  473. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  474. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  475. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  476. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  477. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  478. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  479. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  480. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  481. for(int g=0;g<80;g++) cout<<'*';
  482. cout<<endl<<setw(25)<<" ";
  483.  
  484. cout<<"LOAN RECORD FOUND...!!"<<endl;
  485. }
  486. break;
  487. }
  488.  
  489. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  490. file.getline(account_no,10,'|');
  491. if(strcmp(account_no,"#########")==0)
  492. break;
  493. if(strcmp(account_no,k)==0)
  494. {
  495. found=1;
  496. if(l==1)
  497. {
  498. unpack();
  499. clrscr();
  500. textcolor(15);
  501. textbackground(YELLOW);
  502. cout<<endl;
  503. cout<<setw(18)<<" "<<"THE SEARCHED LOAN RECORD IS DISPLAYED"<<endl<<endl;
  504. for(int f=0;f<80;f++) cout<<'*'; cout<<endl;
  505. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  506. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  507. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  508. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  509. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  510. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  511. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  512. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  513. for(int g=0;g<80;g++) cout<<'*';
  514. cout<<endl<<setw(25)<<" ";
  515.  
  516. cout<<"LOAN RECORD FOUND...!!"<<endl;
  517. }
  518. break;
  519. }
  520. else
  521. {
  522. i++;
  523. if(i%max==0)
  524. i=0;
  525. }
  526. }while(i!=addr);
  527. if(found==0 && l==1)
  528. {
  529. textcolor(15);
  530. textbackground(YELLOW);
  531. cout<<setw(23)<<" "<<"\n\n\t!!*** GIVEN LOAN RECORD DOESNOT EXISTS IN HASH FILE ***!!\n\n";
  532. for(int h=0;h<80;h++) cout<<'~';
  533. for(int j=0;j<80;j++) cout<<'~';
  534. getch();
  535. }
  536. /*if(l==0)
  537. cout<<found<<endl;*/
  538.  
  539. return found ;
  540. }
  541.  
  542. void Loan::datadisp()
  543. {
  544. file.open(datafile,ios::in);
  545. int i=0;
  546. char dummy[10];
  547. cout<<setiosflags(ios::left);
  548. while(i<max)
  549. {
  550. if(file.eof())
  551. break;
  552. file.seekg(i*recsize*bucketsize,ios::beg);
  553. file.getline(dummy,5,'\n');
  554. if(strcmp(dummy,"####")!=0 && strcmp(dummy,"$$$$")!=0)
  555. {
  556. file.seekg(i*recsize*bucketsize,ios::beg);
  557. file.getline(account_no,10,'|');
  558. unpack();
  559. clrscr();
  560. //drawdoublelinebox(17,7,60,30);
  561. textcolor(15);
  562. textbackground(RED);
  563. cout<<endl<<endl<<endl;
  564. cout<<setw(25)<<" "<<"DISPLAYING LOAN RECORDS"<<endl<<endl;
  565. for(int i=0;i<80;i++) cout<<'*'; cout<<endl;
  566. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  567. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  568. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  569. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  570. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  571. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  572. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  573. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  574. for(int k=0;k<80;k++) cout<<'*';
  575. cout<<endl<<endl<<setw(20)<<" ";
  576. getch();
  577.  
  578. }
  579. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  580. file.getline(dummy,5,'\n');
  581. if(strcmp(dummy,"####")!=0 && strcmp(dummy,"$$$$")!=0)
  582. {
  583. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  584. file.getline(account_no,10,'|');
  585. unpack();
  586. clrscr();
  587. textcolor(15);
  588. textbackground(RED);
  589. cout<<endl<<endl<<endl;
  590. cout<<setw(25)<<" "<<"DISPLAYING LOAN RECORDS"<<endl<<endl;
  591. for(int i=0;i<80;i++) cout<<'*'; cout<<endl;
  592. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  593. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  594. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  595. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  596. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  597. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  598. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  599. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  600. for(int k=0;k<80;k++) cout<<'*';
  601. cout<<endl<<endl<<setw(20)<<" ";
  602. getch();
  603.  
  604.  
  605. }
  606. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  607. file.getline(dummy,5,'\n');
  608. if(strcmp(dummy,"####")!=0 && strcmp(dummy,"$$$$")!=0)
  609. {
  610. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  611. file.getline(account_no,10,'|');
  612. unpack();
  613. clrscr();
  614. textcolor(15);
  615. textbackground(RED);
  616. cout<<endl<<endl<<endl;
  617. cout<<setw(25)<<" "<<"DISPLAYING LOAN RECORDS"<<endl<<endl;
  618. for(int i=0;i<80;i++) cout<<'*'; cout<<endl;
  619. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  620. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  621. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  622. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  623. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  624. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  625. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  626. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  627. for(int k=0;k<80;k++) cout<<'*';
  628. cout<<endl<<setw(20)<<" ";
  629. getch();
  630. }
  631. i++;
  632. }
  633. clrscr();
  634. textcolor(15);
  635. textbackground(RED);
  636. cout<<"\n\n\n\n\n\n\n\n\n\t\t=============================================\n"<<endl;
  637. cout<<"\t\t !!*** NO RECORDS TO DISPLAY ***!!"<<endl;
  638. cout<<"\n\t\t=============================================\n"<<endl;
  639. getch();
  640. file.close();
  641. }
  642.  
  643.  
  644.  
  645. int Loan::remove(int addr,char k[])
  646. {
  647. int found=0,i;
  648. char dummy[10];
  649. i=addr;
  650. int s;
  651.  
  652. file.open(datafile,ios::in|ios::out);
  653. cout<<setiosflags(ios::left);
  654. do
  655. {
  656. file.seekg(i*recsize*bucketsize,ios::beg);
  657. file.getline(dummy,5,'\n');
  658. if(strcmp(dummy,"####")==0)
  659. break;
  660. file.seekg(i*recsize*bucketsize,ios::beg);
  661. file.getline(account_no,10,'|');
  662. if(strcmp(account_no,"#########")==0)
  663. break;
  664. if(strcmp(account_no,k)==0)
  665. {
  666. found=1;
  667. unpack();
  668. clrscr();
  669. textcolor(15);
  670. textbackground(1);
  671. cout<<endl<<endl;
  672. cout<<setw(26)<<" "<<"LOAN RECORD DISPLAYED"<<endl;
  673. for(int l=0;l<80;l++) cout<<'*'; cout<<endl;
  674. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  675. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  676. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  677. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  678. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  679. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  680. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  681. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  682. for(int z=0;z<80;z++) cout<<'*';
  683. cout<<endl<<setw(20)<<" ";
  684.  
  685. textcolor(15);
  686. textbackground(1);
  687. cout<<"LOAN RECORD TO BE DELETED IS FOUND"<<endl;
  688. file.seekp(i*recsize*bucketsize,ios::beg);
  689. for(s=0;s<recsize;s++)
  690. file.put('$');
  691. cout<<setw(25)<<" "<<" RECORD IS DELETED... !!"<<endl;
  692. getch();
  693. file.close();
  694. break;
  695. }
  696. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  697. file.getline(account_no,10,'|');
  698. if(strcmp(account_no,"#########")==0)
  699. break;
  700. if(strcmp(account_no,k)==0)
  701. {
  702. found=1;
  703. unpack();
  704. clrscr();
  705. textcolor(15);
  706. textbackground(1);
  707. cout<<endl<<endl;
  708. cout<<setw(26)<<" "<<"LOAN RECORD DISPLAYED"<<endl;
  709. for(int l=0;l<80;l++) cout<<'*'; cout<<endl;
  710. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  711. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  712. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  713. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  714. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  715. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  716. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  717. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  718. for(int z=0;z<80;z++) cout<<'*';
  719. cout<<endl<<setw(20)<<" ";
  720.  
  721. textcolor(15);
  722. textbackground(1);
  723. cout<<"LOAN RECORD TO BE DELETED IS FOUND"<<endl;
  724. file.seekp(i*recsize*bucketsize+recsize,ios::beg);
  725. for(s=0;s<recsize;s++)
  726. file.put('$');
  727. cout<<setw(25)<<" "<<" RECORD IS DELETED... !!"<<endl;
  728. getch();
  729. break;
  730. }
  731.  
  732. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  733. file.getline(account_no,10,'|');
  734. if(strcmp(account_no,k)==0)
  735. {
  736. found=1;
  737. unpack();
  738. clrscr();
  739. textcolor(15);
  740. textbackground(1);
  741. cout<<endl<<endl;
  742. cout<<setw(26)<<" "<<"LOAN RECORD DISPLAYED"<<endl;
  743. for(int l=0;l<80;l++) cout<<'*'; cout<<endl;
  744. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  745. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  746. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  747. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  748. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  749. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  750. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  751. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  752. for(int z=0;z<80;z++) cout<<'*';
  753. cout<<endl<<setw(20)<<" ";
  754.  
  755. textcolor(15);
  756. textbackground(1);
  757. cout<<"LOAN RECORD TO BE DELETED IS FOUND"<<endl;
  758. file.seekp(i*recsize*bucketsize+(2*recsize),ios::beg);
  759. for(s=0;s<recsize-2;s++)
  760. file.put('$');
  761. file.put('\n');
  762. cout<<setw(25)<<" "<<" RECORD IS DELETED... !!"<<endl;
  763. getch();
  764. break;
  765. }
  766. else
  767. {
  768. i++;
  769. if(i%max==0)
  770. i=0;
  771. }
  772. }while(i!=addr);
  773. if(found==0)
  774. {
  775. textcolor(15);
  776. textbackground(1);
  777. cout<<setw(23)<<" "<<"\n\n\t!!*** GIVEN LOAN RECORD DOESNOT EXISTS IN HASH FILE ***!!\n\n";
  778. for(int k=0;k<80;k++) cout<<'^';
  779. for(int j=0;j<80;j++) cout<<'^';
  780. getch();
  781. }
  782. return found;
  783. }
  784.  
  785. void Loan::modify(int addr, char k[])
  786. {
  787. int found=0,i;
  788. char dummy[10];
  789. i=addr;
  790. int s;
  791. int x;
  792.  
  793. file.open(datafile,ios::in|ios::out);
  794. cout<<setiosflags(ios::left);
  795. do
  796. {
  797. file.seekg(i*recsize*bucketsize,ios::beg);
  798. file.getline(dummy,5,'\n');
  799. if(strcmp(dummy,"####")==0)
  800. break;
  801. file.seekg(i*recsize*bucketsize,ios::beg);
  802. file.getline(account_no,10,'|');
  803. if(strcmp(account_no,k)==0)
  804. {
  805. found=1;
  806. unpack();
  807. clrscr();
  808. textcolor(YELLOW);
  809. textbackground(0);
  810. cout<<endl;
  811. cout<<setw(18)<<" "<<"LOAN RECORD TO BE MODIFIED IS DISPLAYED"<<endl<<endl;
  812. for(int c=0;c<80;c++) cout<<'*'; cout<<endl;
  813. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  814. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  815. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  816. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  817. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  818. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  819. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  820. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  821. for(int v=0;v<80;v++) cout<<'*';
  822. cout<<endl<<setw(20)<<" ";
  823.  
  824. textcolor(YELLOW);
  825. textbackground(0);
  826. cout<<"LOAN RECORD TO BE MODIFIED IS FOUND"<<endl;
  827. getch();
  828. file.seekp(i*recsize*bucketsize,ios::beg);
  829. for(s=0;s<recsize;s++)
  830. file.put('$');
  831. cout<<"\t\t\tRECORD DELETED...!!"<<endl;
  832. getch();
  833. file.close();
  834. clrscr();
  835. textcolor(15);
  836. textbackground(1);
  837. cout<<"\n";
  838. for(int b=0;b<80;b++) cout<<'~';
  839. for(int n=0;n<80;n++) cout<<'*';
  840. cout<<"\t\t\tENTER THE NEW(MODIFIED) LOAN RECORD: \n";
  841. getch();
  842. read();
  843. x=hash(account_no);
  844. store(x);
  845.  
  846. cout<<"\t\t RECORD IS MODIFIED SUCCESSFULLY...!!\n";
  847. getch();
  848. break;
  849. }
  850. file.seekg(i*recsize*bucketsize+recsize,ios::beg);
  851. file.getline(account_no,10,'|');
  852. if(strcmp(account_no,"#########")==0)
  853. break;
  854.  
  855. if(strcmp(account_no,k)==0)
  856. {
  857. found=1;
  858. unpack();
  859. clrscr();
  860. textcolor(YELLOW);
  861. textbackground(0);
  862. cout<<endl;
  863. cout<<setw(18)<<" "<<"LOAN RECORD TO BE MODIFIED IS DISPLAYED"<<endl<<endl;
  864. for(int c=0;c<80;c++) cout<<'*'; cout<<endl;
  865. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  866. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  867. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  868. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  869. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  870. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  871. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  872. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  873. for(int v=0;v<80;v++) cout<<'*';
  874. cout<<endl<<setw(20)<<" ";
  875.  
  876. textcolor(YELLOW);
  877. textbackground(0);
  878. cout<<"LOAN RECORD TO BE MODIFIED IS FOUND"<<endl;
  879. getch();
  880. file.seekp(i*recsize*bucketsize+recsize,ios::beg);
  881. for(s=0;s<recsize;s++)
  882. file.put('$');
  883. cout<<"\t\t\tRECORD DELETED...!!"<<endl;
  884. getch();
  885. file.close();
  886. clrscr();
  887. textcolor(15);
  888. textbackground(1);
  889. cout<<"\n";
  890. for(int b=0;b<80;b++) cout<<'~';
  891. for(int n=0;n<80;n++) cout<<'*';
  892. cout<<"\t\t\tENTER THE NEW(MODIFIED) LOAN RECORD: \n";
  893. getch();
  894. read();
  895. x=hash(account_no);
  896. store(x);
  897.  
  898. cout<<"\t\t RECORD IS MODIFIED SUCCESSFULLY...!!\n";
  899. getch();
  900. break;
  901. }
  902.  
  903. file.seekg(i*recsize*bucketsize+(2*recsize),ios::beg);
  904. file.getline(account_no,10,'|');
  905. if(strcmp(account_no,"#########")==0)
  906. break;
  907.  
  908. if(strcmp(account_no,k)==0)
  909. {
  910. found=1;
  911. unpack();
  912. clrscr();
  913. textcolor(YELLOW);
  914. textbackground(0);
  915. cout<<endl;
  916. cout<<setw(18)<<" "<<"LOAN RECORD TO BE MODIFIED IS DISPLAYED"<<endl<<endl;
  917. for(int c=0;c<80;c++) cout<<'*'; cout<<endl;
  918. cout<<setw(20)<<" "<<" ACCOUNT NUMBER : "<<setw(10)<<account_no<<endl<<endl;
  919. cout<<setw(20)<<" "<<" BANCK ID : "<<setw(9)<<bank_id<<endl<<endl;
  920. cout<<setw(20)<<" "<<" CUSTOMER NAME : "<<setw(10)<<cust_name<<endl<<endl;
  921. cout<<setw(20)<<" "<<" PHONE NUMBER : "<<setw(10)<<phone<<endl<<endl;
  922. cout<<setw(20)<<" "<<" OCCUPATION : "<<setw(5)<<occupation<<endl<<endl;
  923. cout<<setw(20)<<" "<<" LOAN TYPE : "<<setw(5)<<loan_type<<endl<<endl;
  924. cout<<setw(20)<<" "<<" BRANCH ID I : "<<setw(6)<<branch_id<<endl<<endl;
  925. cout<<setw(20)<<" "<<" RATE OF INTEREST : "<<setw(5)<<ROI<<endl<<endl;
  926. for(int v=0;v<80;v++) cout<<'*';
  927. cout<<endl<<setw(20)<<" ";
  928.  
  929. textcolor(YELLOW);
  930. textbackground(0);
  931. cout<<"LOAN RECORD TO BE MODIFIED IS FOUND"<<endl;
  932. getch();
  933. file.seekp(i*recsize*bucketsize+(2*recsize),ios::beg);
  934. for(s=0;s<recsize-2;s++)
  935. file.put('$');
  936. file.put('\n');
  937. cout<<"\t\t\tRECORD DELETED...!!"<<endl;
  938. getch();
  939. file.close();
  940. clrscr();
  941. textcolor(15);
  942. textbackground(1);
  943. cout<<"\n";
  944. for(int b=0;b<80;b++) cout<<'~';
  945. for(int n=0;n<80;n++) cout<<'*';
  946. cout<<"\t\t\tENTER THE NEW(MODIFIED) LOAN RECORD: \n";
  947. getch();
  948. read();
  949. x=hash(account_no);
  950. store(x);
  951.  
  952. cout<<"\t\t RECORD IS MODIFIED SUCCESSFULLY...!!\n";
  953. getch();
  954. break;
  955. }
  956. else
  957. {
  958. i++;
  959. if(i%max==0)
  960. i=0;
  961. }
  962. }while(i!=addr);
  963. if(found==0)
  964. {
  965. textcolor(15);
  966. textbackground(1);
  967. cout<<setw(23)<<" "<<"\n\n\t!!*** GIVEN LOAN RECORD DOESNOT EXISTS IN HASH FILE ***!!\n\n";
  968. for(int k=0;k<80;k++) cout<<'=';
  969. for(int j=0;j<80;j++) cout<<'^';
  970. getch();
  971. }
  972. }
  973.  
  974.  
  975.  
  976. /*Douoblebox design*/
  977.  
  978. void drawdoublelinebox(int x,int y,int len,int bdt)
  979. {
  980. gotoxy(x,y);
  981. cprintf("É");
  982. gotoxy(x,y+bdt);
  983. cprintf("È");
  984. gotoxy(x+len,y);
  985. cprintf("»");
  986. gotoxy(x+len,y+bdt);
  987. cprintf("¼");
  988. for(int i=x+1;i<x+len;i++)
  989. {
  990. gotoxy(i,y);
  991. cprintf("Í");
  992. gotoxy(i,y+bdt);
  993. cprintf("Í");
  994. }
  995. for(int j=y+1;j<y+bdt;j++)
  996. {
  997. gotoxy(x,j);
  998. cprintf("º");
  999. gotoxy(x+len,j);
  1000. cprintf("º");
  1001. }
  1002. }
  1003.  
  1004. /*Double box design*/
  1005.  
  1006. void drawsinglelinebox(int x,int y,int len,int bdt)
  1007. { // (x,y) : co.ord. of 1st tip
  1008. gotoxy(x,y); // len : length of box
  1009. cprintf("Ú"); // bdt : breadth of box
  1010. gotoxy(x,y+bdt);
  1011. cprintf("À");
  1012. gotoxy(x+len,y);
  1013. cprintf("¿");
  1014. gotoxy(x+len,y+bdt);
  1015. cprintf("Ù");
  1016.  
  1017. for(int i=x+1;i<x+len;i++)
  1018. {
  1019. gotoxy(i,y);
  1020. cprintf("Ä");
  1021. gotoxy(i,y+bdt);
  1022. cprintf("Ä");
  1023. }
  1024. for(int j=y+1;j<y+bdt;j++)
  1025. {
  1026. gotoxy(x,j);
  1027. cprintf("³");
  1028. gotoxy(x+len,j);
  1029. cprintf("³");
  1030. }
  1031. }
  1032. void normal() // to obtain normal background
  1033. {
  1034. textattr(WHITE); // textattr sets text attributes for text-window functions
  1035. textcolor(WHITE);// textcolor selects a new character color in text mode
  1036. textbackground(BLACK);//textbackground selects a new text background color
  1037. _setcursortype(_NORMALCURSOR); /* sets cursor type to normal underscore type cursor */
  1038. //return;
  1039. }
  1040.  
  1041. void screen()
  1042. {
  1043. int g=19,h=10;
  1044.  
  1045. textbackground(GREEN);
  1046. gotoxy(24,3);
  1047. textcolor(YELLOW);
  1048. cprintf(" LOAN MANAGEMENT ");
  1049. gotoxy(24,4);
  1050. textcolor(15);
  1051. cprintf(" ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ");
  1052. drawdoublelinebox(17,7,44,14);
  1053. gotoxy(28,7);
  1054. textbackground(RED);
  1055. textcolor(YELLOW);
  1056. cprintf("Û M A I N M E N U Û" );
  1057. normal();
  1058. textcolor(15);
  1059. gotoxy(g,h++);
  1060. cout<<" þ LOAN RECORD";
  1061. gotoxy(g,h++);
  1062. cout<<" þ QUIT";
  1063. gotoxy(g,h++);
  1064. gotoxy(g,h++);
  1065. gotoxy(g,h++);
  1066. normal();
  1067. }
  1068.  
  1069.  
  1070. void main()
  1071. {
  1072. int ch,addr,l,choice, found=0;
  1073. char sacc_no[10];
  1074. Loan p;
  1075. p.initial();
  1076. clrscr();
  1077. do
  1078. {
  1079. screen();
  1080. //cout<<"\n============================"<<endl;
  1081. //cout<<"1.read loan details\n2.search loan record\n3.display loan record\n4.delete loan record\n5.modify record\n6.exit\n";
  1082. // cout<<"============================"<<endl;
  1083. cout<<"PLEASE ENTER YOUR CHOICE [1-2] : ";
  1084. cin>>ch;
  1085. switch(ch)
  1086. {
  1087. case 1:do
  1088. {
  1089. clrscr();
  1090. drawdoublelinebox(17,7,44,14);
  1091. textcolor(0);
  1092. textbackground(15);
  1093. clrscr();
  1094. textbackground(BLACK);
  1095. gotoxy(25,3);
  1096. textcolor(YELLOW);
  1097. cprintf(" LOAN RECORDS ");
  1098. gotoxy(25,4);
  1099. cprintf(" ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ");
  1100. int z=19,q=10;
  1101. textcolor(YELLOW);
  1102. drawdoublelinebox(17,7,44,14);
  1103. gotoxy(28,7);
  1104. textbackground(RED);
  1105. textcolor(YELLOW);
  1106. cprintf("Û M A I N M E N U Û" );
  1107. normal();
  1108. textcolor(WHITE);
  1109. gotoxy(z,q++);
  1110. cout<<" 1.> READ LOAN DETAILS";
  1111. gotoxy(z,q++);
  1112. cout<<" 2.> SEARCH LOAN RECORD";
  1113. gotoxy(z,q++);
  1114. cout<<" 3.> DISPLAY LOAN DETAILS";
  1115. gotoxy(z,q++);
  1116. cout<<" 4.> DELETE LOAN RECORD";
  1117. gotoxy(z,q++);
  1118. cout<<" 5.> MODIFY LOAN RECORD";
  1119. gotoxy(z,q++);
  1120. cout<<" 6.> QUIT";
  1121. gotoxy(z,q++);
  1122. gotoxy(z,q++);
  1123. gotoxy(z,q++);
  1124. cout<<" PLEASE ENTER YOUR CHOICE [1-6] : ";
  1125. cin>>choice;
  1126. switch(choice)
  1127. {
  1128. case 1:clrscr();
  1129. cout<<"\n";
  1130. for(int b=0;b<80;b++) cout<<'~';
  1131. cout<<setw(24)<<" "<<"ENTER THE LOAN RECORD DETAILS \n";
  1132. for(int h=0;h<80;h++) cout<<'~';
  1133. cout<<"\n";
  1134. getch();
  1135. LABEL: p.read();
  1136. addr=hash(p.account_no);
  1137. store(addr);
  1138. getch();
  1139. file.close();
  1140. break;
  1141. case 2:clrscr();
  1142. textcolor(15);
  1143. textbackground(YELLOW);
  1144. cout<<"\n\n\n\n";
  1145. cout<<"\t\t\t SEARCHING LOAN RECORD\n\n";
  1146. for(int e=0;e<80;e++) cout<<'~';
  1147. //cout<<"\n";
  1148. for(int w=0;w<80;w++) cout<<'~';
  1149. cout<<"\n";
  1150. cout<<setw(20)<<" "<<"ENTER THE ACCOUNT NUMBER TO BE SEARCHED: "<<endl;
  1151. cout<<setw(36)<<" ";
  1152. cin>>sacc_no;
  1153. cout<<"\n";
  1154. addr=hash(sacc_no);
  1155. p.retrieve(addr,sacc_no,1);
  1156. getch();
  1157. file.close();
  1158. break;
  1159. case 3://cout<<"vehicle details:"<<endl;
  1160. textcolor(15);
  1161. textbackground(RED);
  1162. p.datadisp();
  1163. file.close();
  1164. break;
  1165. case 4://p.del();
  1166. clrscr();
  1167. textcolor(15);
  1168. textbackground(1);
  1169. cout<<"\n\n\n\n";
  1170. cout<<"\t\t\t DELETING LOAN RECORD\n\n";
  1171. for(int x=0;x<80;x++) cout<<'^';
  1172. //cout<<"\n";
  1173. for(int y=0;y<80;y++) cout<<'^';
  1174. cout<<"\n";
  1175. cout<<setw(20)<<" "<<"ENTER THE ACCOUNT NUMBER TO BE DELETED: "<<endl;
  1176. cout<<setw(36)<<" ";
  1177. cin>>sacc_no;
  1178. cout<<"\n";
  1179. addr=hash(sacc_no);
  1180. p.remove(addr,sacc_no);
  1181. getch();
  1182. file.close();
  1183. break;
  1184. case 5:clrscr();
  1185. textcolor(15);
  1186. textbackground(1);
  1187. cout<<"\n\n\n\n";
  1188. cout<<"\t\t\t MODIFYING LOAN RECORD\n\n";
  1189. for(int u=0;u<80;u++) cout<<'=';
  1190. //cout<<"\n";
  1191. for(int r=0;r<80;r++) cout<<'^';
  1192. cout<<"\n";
  1193. cout<<setw(20)<<" "<<"ENTER THE LOAN RECORD TO MODIFY: \n";
  1194. cout<<setw(36)<<" ";
  1195. cin>>sacc_no;
  1196. addr=hash(sacc_no);
  1197. cout<<"\n";
  1198. p.modify(addr,sacc_no);
  1199. getch();
  1200. file.close();
  1201. break;
  1202. case 6:clrscr();
  1203. screen();
  1204. break;
  1205. default:sound(600);delay(500);nosound();
  1206. break;
  1207. }
  1208. }while(choice!=6); break;
  1209.  
  1210. case 2:exit(0);
  1211.  
  1212. default: sound(100);delay(500);nosound(); break;
  1213. }
  1214. }while(ch!=2);
  1215.  
  1216. file.close();
  1217. }

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.