Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.18 KB | None | 0 0
  1. #include<windows.h>
  2. #include<stdio.h>
  3. #include<conio.h> //contains delay(),getch(),gotoxy(),etc.
  4. #include <stdlib.h>
  5. #include<string.h> //contains strcmp(),strcpy(),strlen(),etc
  6. #include<ctype.h> //contains toupper(), tolower(),etc
  7. #include<dos.h> //contains _dos_getdate
  8. #include<time.h>
  9.  
  10. #define RETURNTIME 15
  11.  
  12. //list of function prototype
  13. //char catagories[][25]={"Register Lecturer","Register Student","View Lecturer","View Student","Delete Lecturer","Delete Student","Search Lecturer","Search student","Modify Lecture","Modify Student","View Attendance","Modify Attendance"};
  14. void mainmenu(void);
  15. void returnlect(void);
  16. void returnstud(void);
  17. void checkday(int , char*);
  18. void check_lectdates();
  19. void register_lecturer();
  20. void register_student(void);
  21. void view_lecturer(void);
  22. void view_student(void);
  23. void search_student(void);
  24. void search_lecturer(void);
  25. void delete_lecturer(void);
  26. void delete_student(void);
  27. void modify_student(void);
  28. void modify_lecturer(void);
  29. void closeapplication(void);
  30. void attend(void);
  31. void modify_attendance(void);
  32. int t(void);
  33. int checklid(int);
  34. int checksid(int);
  35. //void closeapplication(void);
  36. void adminoption();
  37. void lectureroption();
  38. void studentoption();
  39. void Password();
  40. //char *cat;
  41. COORD coord = {0, 0}; // sets coordinates to 0,0
  42. //COORD max_buffer_size = GetLargestConsoleWindowSize(hOut);
  43. COORD max_res,cursor_size;
  44. void gotoxy (int x, int y)
  45. {
  46. coord.X = x; coord.Y = y; // X and Y coordinates
  47. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
  48. }
  49. void delay(unsigned int mseconds)
  50. {
  51. clock_t goal = mseconds + clock();
  52. while (goal > clock());
  53. }
  54.  
  55. //list of global files that can be acceed form anywhere in program
  56. FILE *fp,*ft,*fs;
  57.  
  58. //list of global variable
  59. int s;
  60. char findstudent;
  61. char findlecturer;
  62. char password[10]={"codder"};
  63.  
  64. struct merodate
  65. {
  66. int mm,dd,yy;
  67. };
  68.  
  69. struct lecturer
  70. {
  71. char fname[25];
  72. char lname[25];
  73. char address[35];
  74. char faculty[20];
  75. int phoneno[15];
  76. int lid[10]; // lecturer id no.
  77.  
  78. };
  79. struct lecturer lect;
  80.  
  81. struct student
  82. {
  83. char fname[25];
  84. char lname[25];
  85. char address[35];
  86. char faculty[20];
  87. int phoneno[15];
  88. int sid[10]; // student id no.
  89.  
  90. };
  91. struct student stud;
  92.  
  93. int main()
  94.  
  95. {
  96. Password();
  97. getch();
  98. return 0;
  99.  
  100. }
  101.  
  102.  
  103. void mainmenu()
  104.  
  105. {
  106. int i;
  107. system("cls");
  108. // textbackground(13);
  109.  
  110. gotoxy(20,3);
  111. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 MAIN MENU");
  112. printf(" \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  113. gotoxy(20,5);
  114. printf("\xDB\xDB\xDB\xDB\xB2 1. Admin ");
  115. gotoxy(20,7);
  116. printf("\xDB\xDB\xDB\xDB\xB2 2. lecturer");
  117. gotoxy(20,9);
  118. printf("\xDB\xDB\xDB\xDB\xB2 3. student");
  119. gotoxy(20,11);
  120. printf("\xDB\xDB\xDB\xDB\xB2 4. Exit");
  121. gotoxy(20,13);
  122. printf("------------------------------------------");
  123. gotoxy(20,14);
  124. t();
  125. gotoxy(20,15);
  126. printf("Enter your choice:");
  127. switch(getch())
  128.  
  129. {
  130.  
  131. case '1':
  132. adminoption();
  133. break;
  134.  
  135. case '2':
  136. //lectureroption();
  137. break;
  138.  
  139. case '3':
  140. //studentoption();
  141. break;
  142.  
  143. case '4':
  144. {
  145. system("cls");
  146. gotoxy(16,3);
  147. printf("Thanks for using the Program..");
  148. gotoxy(10,7);
  149. printf("Exiting in 5 second...........>");
  150. //flushall();
  151. delay(5000);
  152. exit(0);
  153. }
  154. default:
  155. {
  156. gotoxy(10,23);
  157. printf("\aWrong Entry!!Please re-entered correct option");
  158. if(getch())
  159. mainmenu();
  160. }
  161.  
  162.  
  163. }
  164. }
  165.  
  166.  
  167.  
  168. void adminoption()
  169.  
  170. {
  171. int i,s;
  172. char username[25],password[15];
  173. printf("\nEnter your username:");
  174. scanf("%s",&username);
  175. printf("\nEnter Password:");
  176. scanf("%s",&password);
  177. if(strcmp(username,"admin")==0 && strcmp(password,"password")==0)
  178. {
  179. system("cls");
  180. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 ADMIN PANEL");
  181. printf(" \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  182. gotoxy(20,5);
  183. printf("\xDB\xDB\xDB\xDB\xB2 a. Register lecturer");
  184. gotoxy(20,7);
  185. printf("\xDB\xDB\xDB\xDB\xB2 b. Register student");
  186. gotoxy(20,9);
  187. printf("\xDB\xDB\xDB\xDB\xB2 c. View lecturer");
  188. gotoxy(20,11);
  189. printf("\xDB\xDB\xDB\xDB\xB2 d. View student");
  190. gotoxy(20,13);
  191. printf("\xDB\xDB\xDB\xDB\xB2 e. Delete lecturer");
  192. gotoxy(20,15);
  193. printf("\xDB\xDB\xDB\xDB\xB2 f. Delete student");
  194. gotoxy(20,17);
  195. printf("\xDB\xDB\xDB\xDB\xB2 g. Search lecturer");
  196. gotoxy(20,19);
  197. printf("\xDB\xDB\xDB\xDB\xB2 h. Search student");
  198. gotoxy(20,21);
  199. printf("\xDB\xDB\xDB\xDB\xB2 i. Modify lecturer");
  200. gotoxy(20,23);
  201. printf("\xDB\xDB\xDB\xDB\xB2 j. Modify student");
  202. gotoxy(20,25);
  203. printf("\xDB\xDB\xDB\xDB\xB2 k. View attendance");
  204. gotoxy(20,27);
  205. printf("\xDB\xDB\xDB\xDB\xB2 l. Modify Attendance");
  206. gotoxy(20,29);
  207. printf("------------------------------------------");
  208. gotoxy(20,30);
  209. t();
  210. gotoxy(20,31);
  211. printf("Enter your choice:");
  212. switch(getch())
  213. {
  214. case 'a':
  215. register_lecturer();
  216. break;
  217.  
  218. case 'b':
  219. register_student();
  220. break;
  221.  
  222. case 'c':
  223. view_lecturer();
  224. break;
  225.  
  226. case 'd':
  227. view_student();
  228. break;
  229.  
  230. case 'e':
  231. delete_lecturer();
  232. break;
  233.  
  234. case 'f':
  235. //delete_student();
  236. break;
  237.  
  238. case 'g':
  239. search_lecturer();
  240. break;
  241.  
  242. case'h':
  243. //search_student();
  244. break;
  245.  
  246. case 'i':
  247. //modify_lecturer();
  248. break;
  249.  
  250. case 'j':
  251. //modify_student
  252. break;
  253.  
  254. case 'k':
  255. //view_attendance
  256. break;
  257.  
  258. case'l':
  259. //modify_attendance
  260. break;
  261.  
  262. default:
  263.  
  264. gotoxy(10,23);
  265. printf("\aWrong Entry!!Please re-entered correct option");
  266. if(getch())
  267. adminoption();
  268.  
  269. }
  270. }
  271. }
  272.  
  273. void register_lecturer()
  274. {
  275. system("cls");
  276. int i;
  277. FILE *fp;
  278. fp=fopen("lecturer.dat","ab");
  279.  
  280. gotoxy(20,3);
  281. printf("Enter the Information Below");
  282. gotoxy(20,4);
  283. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  284. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  285. gotoxy(20,5);
  286. printf("\xB2");gotoxy(46,5);printf("\xB2");
  287. gotoxy(20,6);
  288. printf("\xB2");gotoxy(46,6);printf("\xB2");
  289. gotoxy(20,7);
  290. printf("\xB2");gotoxy(46,7);printf("\xB2");
  291. gotoxy(20,8);
  292. printf("\xB2");gotoxy(46,8);printf("\xB2");
  293. gotoxy(20,9);
  294. printf("\xB2");gotoxy(46,9);printf("\xB2");
  295. gotoxy(20,10);
  296. printf("\xB2");gotoxy(46,10);printf("\xB2");
  297. gotoxy(20,11);
  298. printf("\xB2");gotoxy(46,11);printf("\xB2");
  299. gotoxy(20,12);
  300. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  301. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  302. gotoxy(21,5);
  303. printf("Lecturer Information:");
  304. gotoxy(21,6);
  305. printf("First Name :");
  306. scanf("%s",lect.fname);
  307. gotoxy(21,7);
  308. printf("Last Name :");
  309. scanf("%s",lect.lname);
  310. gotoxy(21,8);
  311. printf("Address :");
  312. scanf("%s",lect.address);
  313. gotoxy(21,9);
  314. printf("Phone No. :");
  315. scanf("%d",&lect.phoneno);
  316. gotoxy(21,10);
  317. printf("LID :");
  318. scanf("%d",&lect.lid);
  319. gotoxy(21,13);
  320. fprintf(fp,"\n%s\n%s\n%s\n%s\n%d\n%d\n",lect.fname,lect.lname,lect.address,lect.faculty,lect.phoneno,lect.lid);
  321. printf("Lecturer registered sucessfully!!");
  322. fclose(fp);
  323. gotoxy(21,15);
  324. printf("Register any more?(Y / N):");
  325. if(getch()=='n')
  326. mainmenu();
  327. else
  328. system("cls");
  329. register_lecturer();
  330.  
  331. }
  332.  
  333.  
  334. void register_student()
  335.  
  336. {
  337. system("cls");
  338. int i;
  339. FILE *fs;
  340. fs=fopen("student.dat","ab");
  341. gotoxy(20,3);
  342. printf("Enter the Information Below");
  343. gotoxy(20,4);
  344. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  345. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  346. gotoxy(20,5);
  347. printf("\xB2");gotoxy(46,5);printf("\xB2");
  348. gotoxy(20,6);
  349. printf("\xB2");gotoxy(46,6);printf("\xB2");
  350. gotoxy(20,7);
  351. printf("\xB2");gotoxy(46,7);printf("\xB2");
  352. gotoxy(20,8);
  353. printf("\xB2");gotoxy(46,8);printf("\xB2");
  354. gotoxy(20,9);
  355. printf("\xB2");gotoxy(46,9);printf("\xB2");
  356. gotoxy(20,10);
  357. printf("\xB2");gotoxy(46,10);printf("\xB2");
  358. gotoxy(20,11);
  359. printf("\xB2");gotoxy(46,11);printf("\xB2");
  360. gotoxy(20,12);
  361. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  362. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  363. gotoxy(21,5);
  364. printf("Student Information:");
  365. gotoxy(21,6);
  366. printf("First name :");
  367. scanf("%s",stud.fname);
  368. gotoxy(21,7);
  369. printf("Last name :");
  370. scanf("%s",stud.lname);
  371. gotoxy(21,8);
  372. printf("Address :");
  373. scanf("%s",stud.address);
  374. gotoxy(21,9);
  375. printf("Faculty :");
  376. scanf("%s",stud.faculty);
  377. gotoxy(21,10);
  378. printf("Phone No. :");
  379. scanf("%d",&stud.phoneno);
  380. gotoxy(21,11);
  381. printf("SID. :");
  382. scanf("%d",&stud.sid);
  383. fprintf(fs,"\n%s\n%s\n%s\n%s\n%d\n%d\n",stud.fname,stud.lname,stud.address,stud.faculty,stud.phoneno,stud.sid);
  384. gotoxy(21,14);
  385. printf("Student registered sucessfully!!");
  386. fclose(fs);
  387. gotoxy(21,15);
  388. printf("Register any more?(Y / N):");
  389. if(getch()=='n')
  390. mainmenu();
  391. else
  392. system("cls");
  393. register_student();
  394.  
  395. }
  396. void view_lecturer()
  397.  
  398. {
  399. int i=0,j;
  400. system("cls");
  401. gotoxy(1,1);
  402. printf("*********************************Lecturer List*****************************");
  403. gotoxy(2,2);
  404. printf(" First Name Last Name Address Faculty Phone No. LID ");
  405. j=3;
  406. fp=fopen("lecturer.dat","rb");
  407. while(fread(&lect,sizeof(lect),1,fp)==1)
  408. {
  409. gotoxy(3,j);
  410. printf("%s\t",lect.fname);
  411. gotoxy(16,j);
  412. printf("%s\t",lect.lname);
  413. gotoxy(22,j);
  414. printf("%s",lect.address);
  415. gotoxy(36,j);
  416. printf("%s",lect.faculty);
  417. gotoxy(50,j);
  418. printf("%d",lect.phoneno);
  419. gotoxy(57,j);
  420. printf("%d",lect.lid);
  421. printf("\n\n");
  422. j++;
  423.  
  424. }
  425.  
  426. fclose(fp);
  427. gotoxy(35,25);
  428. returnlect();
  429. }
  430. void view_student()
  431. {
  432. int i=0,j;
  433. system("cls");
  434. gotoxy(1,1);
  435. printf("*********************************Student List*****************************");
  436. gotoxy(2,2);
  437. printf(" First Name Last Name Address Faculty Phone No. SID ");
  438. j=4;
  439. fs=fopen("student.dat","rb");
  440. while(fread(&stud,sizeof(stud),1,fs)==1)
  441. {
  442. gotoxy(3,j);
  443. printf("%s",stud.fname);
  444. gotoxy(16,j);
  445. printf("%s",stud.lname);
  446. gotoxy(22,j);
  447. printf("%s",stud.address);
  448. gotoxy(36,j);
  449. printf("%s",stud.faculty);
  450. gotoxy(50,j);
  451. printf("%d",stud.phoneno);
  452. gotoxy(57,j);
  453. printf("%d",stud.sid);
  454. printf("\n\n");
  455. j++;
  456.  
  457. }
  458. fclose(fs);
  459. gotoxy(35,25);
  460. returnstud();
  461. }
  462.  
  463. void delete_lecturer()
  464. {
  465. system("cls");
  466. int d;
  467. char another='y';
  468. while(another=='y') //infinite loop
  469. {
  470. system("cls");
  471. gotoxy(10,5);
  472. printf("Enter the Lecturer ID to delete:");
  473. scanf("%d",&d);
  474. fp=fopen("lecturer.dat","rb+");
  475. rewind(fp);
  476. while(fread(&lect,sizeof(lect),1,fp)==1)
  477. {
  478. if(lect.lid==d)
  479. {
  480.  
  481. gotoxy(10,7);
  482. printf("The lecturer is available");
  483. gotoxy(10,8);
  484. printf("lecturer name is %s",lect.fname);
  485. gotoxy(10,9);
  486. printf("Lecturer Faculty. is %s",lect.faculty);
  487. findlecturer='t';
  488. }
  489. }
  490. if(findlecturer!='t')
  491. {
  492. gotoxy(10,10);
  493. printf("No record is found modify the search");
  494. if(getch())
  495. mainmenu();
  496. }
  497. if(findlecturer=='t' )
  498. {
  499. gotoxy(10,9);
  500. printf("Do you want to delete it?(Y/N):");
  501. if(getch()=='y')
  502. {
  503. ft=fopen("ldel.dat.","wb+"); //temporary file for delete
  504. rewind(fp);
  505. while(fread(&lect,sizeof(lect),1,fp)==1)
  506. {
  507. if(lect.lid!=d)
  508. {
  509. fseek(ft,0,SEEK_CUR);
  510. fwrite(&lect,sizeof(lect),1,ft); //write all in tempory file except that
  511. } //we want to delete
  512. }
  513. fclose(ft);
  514. fclose(fp);
  515. remove("lecturer.dat");
  516. rename("ldel.dat","lecturer.dat"); //copy all item frtemporary file to fp except that
  517. fp=fopen("lecturer.dat","rb+"); //we want to delete
  518. if(findlecturer=='t')
  519. {
  520. gotoxy(10,10);
  521. printf("The record is sucessfully deleted");
  522. gotoxy(10,11);
  523. printf("Delete another record?(Y/N)");
  524. }
  525. }
  526. else
  527. mainmenu();
  528. fflush(stdin);
  529. another=getch();
  530. }
  531. gotoxy(10,15);
  532. mainmenu();
  533. }
  534. }
  535. void search_lecturer()
  536.  
  537. {
  538.  
  539. system("cls");
  540. int d=0,i;
  541. printf("*****************************Search Teacher*********************************");
  542. gotoxy(20,10);
  543. printf("\xDB\xDB\xDB\xB2 1. Search By LID");
  544. gotoxy(20,14);
  545. printf("\xDB\xDB\xDB\xB2 2. Search By Name");
  546. gotoxy( 15,20);
  547. printf("Enter Your Choice");
  548. fp=fopen("lecturer.dat","rb+"); //open file for reading propose
  549. rewind(fp); //move pointer at the begining of file
  550. switch(getch())
  551. {
  552. case '1':
  553. {
  554. system("cls");
  555. gotoxy(25,4);
  556. printf("****Search Teacher By ID****");
  557. gotoxy(20,5);
  558. printf("Enter The Lecturer ID:");
  559. scanf("%d",&d);
  560. gotoxy(20,7);
  561. printf("Searching........");
  562. while(fread(&lect,sizeof(lect),1,fp)==1)
  563. {
  564. if(lect.lid==d) //checks whether a.id is equal to d or not
  565. {
  566. delay(2);
  567. gotoxy(20,7);
  568. printf("The lecturer found");
  569. gotoxy(20,8);
  570. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  571. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  572. gotoxy(20,9);
  573. printf("\xB2 First Name:%s",lect.fname);gotoxy(47,9);printf("\xB2");
  574. gotoxy(20,10);
  575. printf("\xB2 Last Name:%s",lect.lname);gotoxy(47,10);printf("\xB2");
  576. gotoxy(20,11);
  577. printf("\xB2 Address:%s ",lect.address);gotoxy(47,11);printf("\xB2");
  578. gotoxy(20,12);
  579. printf("\xB2 Faculty:%s ",lect.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  580. gotoxy(20,13);
  581. printf("\xB2 Phone No.:%d",lect.phoneno);gotoxy(47,13);printf("\xB2");
  582. gotoxy(20,14);
  583. printf("\xB2 LID:%d ",lect.lid);gotoxy(47,14);printf("\xB2");
  584. gotoxy(20,15);
  585. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  586. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  587. findlecturer='t';
  588. }
  589.  
  590. }
  591. if(findlecturer!='t') //checks whether conditiion enters inside loop or not
  592. {
  593. gotoxy(20,8);
  594. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  595. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  596. gotoxy(20,10);
  597. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  598. gotoxy(22,9);printf("\aNo Record Found");
  599. }
  600. gotoxy(20,17);
  601. printf("Try another search?(Y/N)");
  602. if(getch()=='y')
  603. search_lecturer();
  604. else
  605. mainmenu();
  606. break;
  607. }
  608. case '2':
  609. {
  610. char s[25];
  611. system("cls");
  612. gotoxy(25,4);
  613. printf("****Search Lecturer By Name****");
  614. gotoxy(20,5);
  615. printf("Enter Lecturer First Name:");
  616. scanf("%s",s);
  617. int d=0;
  618. while(fread(&lect,sizeof(lect),1,fp)==1)
  619. {
  620. if(strcmp(lect.fname,(s))==0) //checks whether a.name is equal to s or not
  621. {
  622. gotoxy(20,7);
  623. printf("The Lecturer found");
  624. gotoxy(20,8);
  625. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  626. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  627. gotoxy(20,9);
  628. printf("\xB2 First Name:%s",lect.fname);gotoxy(47,9);printf("\xB2");
  629. gotoxy(20,10);
  630. printf("\xB2 Last Name:%s",lect.lname);gotoxy(47,10);printf("\xB2");
  631. gotoxy(20,11);
  632. printf("\xB2 Address:%s ",lect.address);gotoxy(47,11);printf("\xB2");
  633. gotoxy(20,12);
  634. printf("\xB2 Faculty:%s ",lect.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  635. gotoxy(20,13);
  636. printf("\xB2 Phone No.:%d",lect.phoneno);gotoxy(47,13);printf("\xB2");
  637. gotoxy(20,14);
  638. printf("\xB2 LID:%d ",lect.lid);gotoxy(47,14);printf("\xB2");
  639. gotoxy(20,15);
  640. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  641. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  642. d++;
  643. }
  644.  
  645. }
  646. if(d==0)
  647. {
  648. gotoxy(20,8);
  649. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  650. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  651. gotoxy(20,10);
  652. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  653. gotoxy(22,9);printf("\aNo Lecturer Found");
  654. }
  655. gotoxy(20,17);
  656. printf("Try another search?(Y/N)");
  657. if(getch()=='y')
  658. search_lecturer();
  659. else
  660. mainmenu();
  661. break;
  662. }
  663.  
  664. default :
  665. getch();
  666. search_lecturer();
  667. fclose(fp);
  668. }
  669. }
  670. void returnlect(void)
  671. {
  672. printf(" Press ENTER to return to main menu");
  673. lect:
  674. if(getch()==13) //allow only use of enter
  675. mainmenu();
  676. else
  677. goto lect;
  678. }
  679.  
  680. void returnstud(void)
  681. {
  682.  
  683. printf(" Press ENTER to return to main menu");
  684. stud:
  685. if(getch()==13) //allow only use of enter
  686. mainmenu();
  687. else
  688. goto stud;
  689. }
  690. int t(void) //for time
  691. {
  692. time_t t;
  693. time(&t);
  694. printf("Date and time:%s\n",ctime(&t));
  695.  
  696. return 0 ;
  697. }
  698.  
  699.  
  700. void Password(void) //for password option
  701. {
  702.  
  703. system("cls");
  704. char d[25]="Password Protected";
  705. char ch,pass[10];
  706. int i=0,j;
  707. //textbackground(WHITE);
  708. //textcolor(RED);
  709. gotoxy(10,4);
  710. for(j=0;j<20;j++)
  711.  
  712. {
  713. delay(5);
  714. printf("*");
  715. }
  716.  
  717. for(j=0;j<20;j++)
  718.  
  719. {
  720. delay(5);
  721. printf("%c",d[j]);
  722. }
  723.  
  724. for(j=0;j<20;j++)
  725. {
  726. delay(5);
  727. printf("*");
  728. }
  729.  
  730. gotoxy(10,10);
  731. gotoxy(15,7);
  732. printf("Enter Password:");
  733.  
  734. while(ch!=13)
  735. {
  736. ch=getch();
  737.  
  738. if(ch!=13 && ch!=8)
  739. {
  740. putch('*');
  741. pass[i] = ch;
  742. i++;
  743. }
  744. }
  745. pass[i] = '\0';
  746. if(strcmp(pass,password)==0)
  747.  
  748. {
  749. gotoxy(15,9);
  750. //textcolor(BLINK);
  751. printf("Password match");
  752. gotoxy(17,10);
  753. printf("Press any key to countinue.....");
  754. getch();
  755. mainmenu();
  756. }
  757. else
  758.  
  759. {
  760. gotoxy(15,16);
  761. printf("\aWarning!! Incorrect Password");
  762. getch();
  763. Password();
  764. }
  765. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement