void MENU :: MAIN_MENU(void) { char ch ; LINES line ; do { textmode(C40) ; clrscr() ; line.BOX(2,1,39,25,219) ; line.BOX(6,5,35,21,218) ; line.BOX(12,7,26,9,218) ; gotoxy(13,8) ; cout <<"VIDEO LIBRARY" ; gotoxy(11,11) ; cout <<"1: ADD NEW CASSETTE" ; gotoxy(11,12) ; cout <<"2: ISSUE CASSETTE" ; gotoxy(11,13) ; cout <<"3: RETURN CASSETTE" ; gotoxy(11,14) ; cout <<"4: DISPLAY" ; gotoxy(11,15) ; cout <<"5: EDIT" ; gotoxy(11,16) ; cout <<"0: QUIT" ; gotoxy(11,19) ; cout <<"Enter your choice:" ; ch = getch() ; textmode(C80) ; clrscr() ; CASSETTE cas ; ISSUE_RETURN ir ; switch(ch) { case 27,'0' : break ; case '1' : cas.ADDITION() ; break ; case '2' : ir.ISSUE() ; break ; case '3' : ir.RETURN() ; break ; case '4' : DISPLAY_MENU() ; break ; case '5' : EDIT_MENU() ; break ; } } while (ch != 27 && ch != '0') ; }
void MENU :: DISPLAY_MENU(void) { char ch ; LINES line ; do { textmode(C40) ; clrscr() ; line.BOX(2,1,39,25,219) ; line.BOX(6,5,35,21,218) ; line.BOX(14,8,25,10,218) ; gotoxy(15,9) ; cout <<"DISPLAY..." ; gotoxy(10,12) ; cout <<"1: LIST OF CASSETTE" ; gotoxy(10,13) ; cout <<"2: LIST OF CUSTOMER" ; gotoxy(10,14) ; cout <<"3: CASSETTE RECORD" ; gotoxy(10,15) ; cout <<"4: CUSTOMER RECORD" ; gotoxy(10,16) ; cout <<"0: EXIT" ; gotoxy(10,18) ; cout <<"Enter your choice:" ; ch = getch() ; textmode(C80) ; clrscr() ; CASSETTE cas ; CUSTOMER cust ; switch(ch) { case 27,'0' : break ; case '1' : cas.LIST() ; break ; case '2' : cust.LIST() ; break ; case '3' : cas.DISPLAY() ; break ; case '4' : cust.DISPLAY() ; break ; } } while (ch != 27 && ch != '0') ; }
void CASSETTE :: DISPLAY(void) { MENU menu ; char filename[13] ; strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; char t1[10] ; int t2, cascode ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Cassette " ; gets(t1) ; t2 = atoi(t1) ; cascode = t2 ; if (cascode == 0) return ; clrscr() ; if (!FOUND_CODE(filename,cascode)) { gotoxy(5,5) ; cout <<"\7Record not found" ; getch() ; return ; } LINES line ; line.BOX(2,1,79,25,218) ; DISPLAY_RECORD(filename,cascode) ; gotoxy(5,24) ; cout <<"Press any key to continue..." ; getch() ; }
void CUSTOMER :: DISPLAY(void) { char t1[10] ; int t2, custcode ; gotoxy(72,2) ; cout <<"<0>=EXIT" ; gotoxy(5,5) ; cout <<"Enter code of the Customer " ; gets(t1) ; t2 = atoi(t1) ; custcode = t2 ; if (custcode == 0) return ; clrscr() ; if (!FOUND_CODE(custcode)) { gotoxy(5,5) ; cout <<"\7Record not found" ; getch() ; return ; } LINES line ; line.BOX(2,1,79,25,218) ; DISPLAY_RECORD(custcode) ; gotoxy(5,24) ; cout <<"Press any key to continue..." ; getch() ; }
void MENU :: EDIT_MENU(void) { char ch ; LINES line ; do { textmode(C40) ; clrscr() ; line.BOX(2,1,39,25,219) ; line.BOX(6,5,35,21,218) ; line.BOX(14,8,24,10,218) ; gotoxy(15,9) ; cout <<"EDIT MENU" ; gotoxy(10,12) ; cout <<"1: MODIFY CASSETTE" ; gotoxy(10,14) ; cout <<"2: DELETE CASSETTE" ; gotoxy(10,16) ; cout <<"0: EXIT" ; gotoxy(10,18) ; cout <<"Enter your choice:" ; ch = getch() ; textmode(C80) ; clrscr() ; CASSETTE cas ; switch(ch) { case 27,'0' : break ; case '1' : cas.MODIFICATION() ; break ; case '2' : cas.DELETION() ; break ; } } while (ch != 27 && ch != '0') ; }
char *MENU :: CHOICE_MENU(void) { char ch ; LINES line ; do { textmode(C40) ; clrscr() ; line.BOX(2,1,39,25,219) ; line.BOX(6,5,35,21,218) ; gotoxy(11,9) ; cout <<"SELECT CASSETTE FOR..." ; gotoxy(12,12) ; cout <<"H: HINDI FILMS" ; gotoxy(12,13) ; cout <<"E: ENGLISH FILMS" ; gotoxy(12,14) ; cout <<"N: NON FILMS" ; gotoxy(12,17) ; cout <<"Enter your choice:" ; ch = getch() ; ch = toupper(ch) ; textmode(C80) ; clrscr() ; switch(ch) { case 27,'0' : break ; case 'H' : return "HINDI.DAT" ; case 'E' : return "ENGLISH.DAT" ; case 'N' : return "NONFILM.DAT" ; } } while (ch != 27 && ch != '0') ; return "FAILED" ; }
void CASSETTE :: ADDITION(void) { MENU menu ; char filename[13], casname[36], ch ; int cascode, valid ; do { strcpy(filename,menu.CHOICE_MENU()) ; if (!strcmpi(filename,"FAILED")) return ; cascode = LASTCODE(filename) + 1 ; LINES line ; line.BOX(10,6,71,21,219) ; line.LINE_HOR(11,70,10,196) ; gotoxy(72,1) ; cout <<"<0>=EXIT" ; gotoxy(27,8) ; cout <<"ADDITION OF NEW CASSETTES" ; gotoxy(20,12) ; cout <<"Code # " <<cascode ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER NAME OF THE CASSETTE" ; gotoxy(20,14) ; cout <<" " ; gotoxy(20,14) ; cout <<"Name : " ; gets(casname) ; if (casname[0] == '0') return ; if (strlen(casname) < 1 || strlen(casname) > 35) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter Correctly (Range: 1..35)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; do { gotoxy(20,17) ; cout <<" " ; gotoxy(20,17) ; cout <<"Do you want to save (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'Y') { char casstatus='A' ; int ccode=0 ; ADD_RECORD(filename,cascode,casname,casstatus,ccode) ; cascode++ ; } do { gotoxy(20,19) ; cout <<" " ; gotoxy(20,19) ; cout <<"Do you want to Add more (y/n) " ; ch = getche() ; ch = toupper(ch) ; if (ch == '0') return ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; } while (ch == 'Y') ; }