Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.26 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 view_attendance(void);
  31. void take_attendance(void);
  32. void modify_attendance(void);
  33. int t(void);
  34. int checklid(int);
  35. int checksid(int);
  36. //void closeapplication(void);
  37. void adminoption();
  38. void lectureroption();
  39. void studentoption();
  40. void Password();
  41. //char *cat;
  42. COORD coord = {0, 0}; // sets coordinates to 0,0
  43. //COORD max_buffer_size = GetLargestConsoleWindowSize(hOut);
  44. COORD max_res,cursor_size;
  45. void gotoxy (int x, int y)
  46. {
  47. coord.X = x; coord.Y = y; // X and Y coordinates
  48. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
  49. }
  50. void delay(unsigned int mseconds)
  51. {
  52. clock_t goal = mseconds + clock();
  53. while (goal > clock());
  54. }
  55.  
  56. //list of global files that can be acceed form anywhere in program
  57. FILE *fp,*ft,*fs;
  58.  
  59. //list of global variable
  60. int s;
  61. int temp;
  62. char findstudent;
  63. char findlecturer;
  64. char password[10]={"codder"};
  65.  
  66. struct merodate
  67. {
  68. int mm,dd,yy;
  69. };
  70.  
  71. struct Attendance{
  72. int id;
  73. int student_id;
  74. char lectured_date[25];
  75. char start_time[50];
  76. char end_time[50];
  77. char module_name[50];
  78. char intake_code[50];
  79. char status[25];
  80. };
  81.  
  82. struct lecturer
  83. {
  84. char fname[25];
  85. char lname[25];
  86. char address[35];
  87. char faculty[20];
  88. int phoneno;
  89. int lid; // lecturer id no.
  90.  
  91. };
  92. struct lecturer lect;
  93.  
  94. struct student
  95. {
  96. char fname[25];
  97. char lname[25];
  98. char address[35];
  99. char faculty[20];
  100. int phoneno;
  101. int sid; // student id no.
  102.  
  103. };
  104. struct student stud;
  105.  
  106. int main()
  107.  
  108. {
  109.  
  110. Password();
  111. getch();
  112. return 0;
  113.  
  114. }
  115.  
  116.  
  117. void mainmenu()
  118.  
  119. {
  120. int i;
  121. system("cls");
  122. // textbackground(13);
  123.  
  124. gotoxy(20,3);
  125. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 MAIN MENU");
  126. printf(" \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  127. gotoxy(20,5);
  128. printf("\xDB\xDB\xDB\xDB\xB2 1. Admin ");
  129. gotoxy(20,7);
  130. printf("\xDB\xDB\xDB\xDB\xB2 2. lecturer");
  131. gotoxy(20,9);
  132. printf("\xDB\xDB\xDB\xDB\xB2 3. student");
  133. gotoxy(20,11);
  134. printf("\xDB\xDB\xDB\xDB\xB2 4. Exit");
  135. gotoxy(20,13);
  136. printf("------------------------------------------");
  137. gotoxy(20,14);
  138. t();
  139. gotoxy(20,15);
  140. printf("Enter your choice:");
  141. switch(getch())
  142.  
  143. {
  144.  
  145. case '1':
  146. adminoption();
  147. break;
  148.  
  149. case '2':
  150. lectureroption();
  151. break;
  152.  
  153. case '3':
  154. //studentoption();
  155. break;
  156.  
  157. case '4':
  158. {
  159. system("cls");
  160. gotoxy(16,3);
  161. printf("Thanks for using the Program..");
  162. gotoxy(10,7);
  163. printf("Exiting in 5 second...........>");
  164. //flushall();
  165. delay(5000);
  166. exit(0);
  167. }
  168. default:
  169. {
  170. gotoxy(10,23);
  171. printf("\aWrong Entry!!Please re-entered correct option");
  172. if(getch())
  173. mainmenu();
  174. }
  175.  
  176.  
  177. }
  178. }
  179.  
  180.  
  181.  
  182. void adminoption()
  183.  
  184. {
  185. int i,s;
  186. /*char username[25],password[15];
  187. printf("\nEnter your username:");
  188. scanf("%s",&username);
  189. printf("\nEnter Password:");
  190. scanf("%s",&password);
  191. if(strcmp(username,"admin")==0 && strcmp(password,"password")==0)
  192. {*/
  193. system("cls");
  194. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 ADMIN PANEL");
  195. printf(" \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  196. gotoxy(20,5);
  197. printf("\xDB\xDB\xDB\xDB\xB2 a. Register lecturer");
  198. gotoxy(20,7);
  199. printf("\xDB\xDB\xDB\xDB\xB2 b. Register student");
  200. gotoxy(20,9);
  201. printf("\xDB\xDB\xDB\xDB\xB2 c. View lecturer");
  202. gotoxy(20,11);
  203. printf("\xDB\xDB\xDB\xDB\xB2 d. View student");
  204. gotoxy(20,13);
  205. printf("\xDB\xDB\xDB\xDB\xB2 e. Delete lecturer");
  206. gotoxy(20,15);
  207. printf("\xDB\xDB\xDB\xDB\xB2 f. Delete student");
  208. gotoxy(20,17);
  209. printf("\xDB\xDB\xDB\xDB\xB2 g. Search lecturer");
  210. gotoxy(20,19);
  211. printf("\xDB\xDB\xDB\xDB\xB2 h. Search student");
  212. gotoxy(20,21);
  213. printf("\xDB\xDB\xDB\xDB\xB2 i. Modify lecturer");
  214. gotoxy(20,23);
  215. printf("\xDB\xDB\xDB\xDB\xB2 j. Modify student");
  216. gotoxy(20,25);
  217. printf("\xDB\xDB\xDB\xDB\xB2 k. View attendance");
  218. gotoxy(20,27);
  219. printf("\xDB\xDB\xDB\xDB\xB2 l. Modify Attendance");
  220. gotoxy(20,29);
  221. printf("------------------------------------------");
  222. gotoxy(20,30);
  223. t();
  224. gotoxy(20,31);
  225. printf("Enter your choice:");
  226. switch(getch())
  227. {
  228. case 'a':
  229. register_lecturer();
  230. break;
  231.  
  232. case 'b':
  233. register_student();
  234. break;
  235.  
  236. case 'c':
  237. view_lecturer();
  238. break;
  239.  
  240. case 'd':
  241. view_student();
  242. break;
  243.  
  244. case 'e':
  245. delete_lecturer();
  246. break;
  247.  
  248. case 'f':
  249. delete_student();
  250. break;
  251.  
  252. case 'g':
  253. search_lecturer();
  254. break;
  255.  
  256. case'h':
  257. search_student();
  258. break;
  259.  
  260. case 'i':
  261. modify_lecturer();
  262. break;
  263.  
  264. case 'j':
  265. modify_student();
  266. break;
  267.  
  268. case 'k':
  269. //view_attendance
  270. break;
  271.  
  272. case'l':
  273. //modify_attendance
  274. break;
  275.  
  276. default:
  277.  
  278. gotoxy(10,23);
  279. printf("\aWrong Entry!!Please re-entered correct option");
  280. if(getch())
  281. adminoption();
  282.  
  283. }
  284. //}
  285. }
  286.  
  287. void register_lecturer()
  288. {
  289. struct lecturer lect;
  290. system("cls");
  291. int i;
  292. FILE *fp=NULL;
  293. fp=fopen("lecturer.dat","a");
  294.  
  295. gotoxy(20,3);
  296. printf("Enter the Information Below");
  297. gotoxy(20,4);
  298. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  299. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  300. gotoxy(20,5);
  301. printf("\xB2");gotoxy(46,5);printf("\xB2");
  302. gotoxy(20,6);
  303. printf("\xB2");gotoxy(46,6);printf("\xB2");
  304. gotoxy(20,7);
  305. printf("\xB2");gotoxy(46,7);printf("\xB2");
  306. gotoxy(20,8);
  307. printf("\xB2");gotoxy(46,8);printf("\xB2");
  308. gotoxy(20,9);
  309. printf("\xB2");gotoxy(46,9);printf("\xB2");
  310. gotoxy(20,10);
  311. printf("\xB2");gotoxy(46,10);printf("\xB2");
  312. gotoxy(20,11);
  313. printf("\xB2");gotoxy(46,11);printf("\xB2");
  314. gotoxy(20,12);
  315. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  316. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  317. gotoxy(21,5);
  318. printf("Lecturer Information:");
  319. gotoxy(21,6);
  320. printf("First Name :");
  321. scanf("%s",lect.fname);
  322. gotoxy(21,7);
  323. printf("Last Name :");
  324. scanf("%s",lect.lname);
  325. gotoxy(21,8);
  326. printf("Address :");
  327. scanf("%s",lect.address);
  328. gotoxy(21,9);
  329. printf("Phone No. :");
  330. scanf("%d",&lect.phoneno);
  331. gotoxy(21,10);
  332. printf("LID :");
  333. scanf("%d",&lect.lid);
  334. gotoxy(21,13);
  335. fprintf(fp, "\n%s %s %s %d %d\n",lect.fname,lect.lname,lect.address,lect.phoneno,lect.lid);
  336. printf("Lecturer registered sucessfully!!");
  337. fclose(fp);
  338. fflush(stdin);
  339. gotoxy(21,15);
  340. printf("Register any more?(Y / N):");
  341. if(getch()=='n')
  342. mainmenu();
  343. else
  344. system("cls");
  345. register_lecturer();
  346.  
  347. }
  348.  
  349.  
  350. void register_student()
  351.  
  352. {
  353. system("cls");
  354. int i;
  355. FILE *fs;
  356. fs=fopen("student.dat","a");
  357. gotoxy(20,3);
  358. printf("Enter the Information Below");
  359. gotoxy(20,4);
  360. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  361. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  362. gotoxy(20,5);
  363. printf("\xB2");gotoxy(46,5);printf("\xB2");
  364. gotoxy(20,6);
  365. printf("\xB2");gotoxy(46,6);printf("\xB2");
  366. gotoxy(20,7);
  367. printf("\xB2");gotoxy(46,7);printf("\xB2");
  368. gotoxy(20,8);
  369. printf("\xB2");gotoxy(46,8);printf("\xB2");
  370. gotoxy(20,9);
  371. printf("\xB2");gotoxy(46,9);printf("\xB2");
  372. gotoxy(20,10);
  373. printf("\xB2");gotoxy(46,10);printf("\xB2");
  374. gotoxy(20,11);
  375. printf("\xB2");gotoxy(46,11);printf("\xB2");
  376. gotoxy(20,12);
  377. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  378. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  379. gotoxy(21,5);
  380. printf("Student Information:");
  381. gotoxy(21,6);
  382. printf("First name :");
  383. scanf("%s",stud.fname);
  384. gotoxy(21,7);
  385. printf("Last name :");
  386. scanf("%s",stud.lname);
  387. gotoxy(21,8);
  388. printf("Address :");
  389. scanf("%s",stud.address);
  390. gotoxy(21,9);
  391. printf("Faculty :");
  392. scanf("%s",stud.faculty);
  393. gotoxy(21,10);
  394. printf("Phone No. :");
  395. scanf("%d",&stud.phoneno);
  396. gotoxy(21,11);
  397. printf("SID. :");
  398. scanf("%d",&stud.sid);
  399. fprintf(fs,"\n%s\t\t%s\t\t%s\t\t%s\t\t%d\t\t%d\n",stud.fname,stud.lname,stud.address,stud.faculty,stud.phoneno,stud.sid);
  400. gotoxy(21,14);
  401. printf("Student registered successfully!!");
  402. fclose(fs);
  403. gotoxy(21,15);
  404. printf("Register any more?(Y / N):");
  405. if(getch()=='n')
  406. mainmenu();
  407. else
  408. system("cls");
  409. register_student();
  410.  
  411. }
  412. void view_lecturer(void)
  413.  
  414. {
  415. struct lecturer lect;
  416. int i=0,j;
  417. system("cls");
  418. gotoxy(1,1);
  419. printf("*********************************Lecturer List*****************************");
  420. gotoxy(2,2);
  421. printf("First Name Last Name Address Phone No. LID ");
  422. j=4;
  423. fp=fopen("lecturer.dat","rb");
  424. while(fread(&lect,sizeof(lect),1,fp)==1)
  425. {
  426.  
  427. gotoxy(3,j);
  428. printf("%s",lect.fname);
  429. gotoxy(16,j);
  430. printf("%s",lect.lname);
  431. gotoxy(22,j);
  432. printf("%s",lect.address);
  433. gotoxy(36,j);
  434. printf("%d",lect.phoneno);
  435. gotoxy(57,j);
  436. printf("%d\t\t",lect.lid);
  437. printf("\n\n");
  438. j++;
  439.  
  440. }
  441. fflush(stdin);
  442. fclose(fp);
  443. gotoxy(70,25);
  444. returnlect();
  445. }
  446. void view_student()
  447. {
  448. int i=0,j;
  449. system("cls");
  450. gotoxy(1,1);
  451. printf("*********************************Student List*****************************");
  452. gotoxy(2,2);
  453. printf(" First Name Last Name Address Faculty Phone No. SID ");
  454. j=4;
  455. fs=fopen("student.dat","rb");
  456. while(fread(&stud,sizeof(stud),1,fs)==1)
  457. {
  458. gotoxy(3,j);
  459. printf("%s\t",stud.fname);
  460. gotoxy(16,j);
  461. printf("%s\t",stud.lname);
  462. gotoxy(22,j);
  463. printf("%s\t",stud.address);
  464. gotoxy(36,j);
  465. printf("%s\t",stud.faculty);
  466. gotoxy(50,j);
  467. printf("%d\t",stud.phoneno);
  468. gotoxy(57,j);
  469. printf("%d\t",stud.sid);
  470. printf("\n\n");
  471. j++;
  472. fclose(fs);
  473. }
  474.  
  475. gotoxy(35,25);
  476. returnstud();
  477. }
  478.  
  479. void delete_lecturer()
  480. {
  481. system("cls");
  482. int d;
  483. char another='y';
  484. while(another=='y') //infinite loop
  485. {
  486. system("cls");
  487. gotoxy(10,5);
  488. printf("Enter the Lecturer ID to delete:");
  489. scanf("%d",&d);
  490. fp=fopen("lecturer.dat","rb+");
  491. rewind(fp);
  492. while(fread(&lect,sizeof(lect),1,fp)==1)
  493. {
  494. if(lect.lid==d)
  495. {
  496.  
  497. gotoxy(10,7);
  498. printf("The lecturer is available");
  499. gotoxy(10,8);
  500. printf("lecturer name is %s",lect.fname);
  501. gotoxy(10,9);
  502. printf("Lecturer Faculty. is %s",lect.faculty);
  503. findlecturer='t';
  504. }
  505. }
  506. if(findlecturer!='t')
  507. {
  508. gotoxy(10,10);
  509. printf("No record is found modify the search");
  510. if(getch())
  511. mainmenu();
  512. }
  513. if(findlecturer=='t' )
  514. {
  515. gotoxy(10,9);
  516. printf("Do you want to delete it?(Y/N):");
  517. if(getch()=='y')
  518. {
  519. ft=fopen("ldel.dat.","wb+"); //temporary file for delete
  520. rewind(fp);
  521. while(fread(&lect,sizeof(lect),1,fp)==1)
  522. {
  523. if(lect.lid!=d)
  524. {
  525. fseek(ft,0,SEEK_CUR);
  526. fwrite(&lect,sizeof(lect),1,ft); //write all in tempory file except that
  527. } //we want to delete
  528. }
  529. fclose(ft);
  530. fclose(fp);
  531. remove("lecturer.dat");
  532. rename("ldel.dat","lecturer.dat"); //copy all item frtemporary file to fp except that
  533. fp=fopen("lecturer.dat","rb+"); //we want to delete
  534. if(findlecturer=='t')
  535. {
  536. gotoxy(10,10);
  537. printf("The record is sucessfully deleted");
  538. gotoxy(10,11);
  539. printf("Delete another record?(Y/N)");
  540. }
  541. }
  542. else
  543. mainmenu();
  544. fflush(stdin);
  545. another=getch();
  546. }
  547. gotoxy(10,15);
  548. mainmenu();
  549. }
  550. }
  551. void delete_student(void)
  552.  
  553. {
  554.  
  555. system("cls");
  556. int d;
  557. char another='y';
  558. while(another=='y') //infinite loop
  559. {
  560. system("cls");
  561. gotoxy(10,5);
  562. printf("Enter the Student ID to delete:");
  563. scanf("%d",&d);
  564. fs=fopen("student.dat","rb+");
  565. rewind(fs);
  566. while(fread(&stud,sizeof(stud),1,fs)==1)
  567. {
  568. if(stud.sid==d)
  569. {
  570.  
  571. gotoxy(10,7);
  572. printf("The student is available");
  573. gotoxy(10,8);
  574. printf("Student name is %s",stud.fname);
  575. gotoxy(10,9);
  576. printf("Student Faculty. is %s",stud.faculty);
  577. findlecturer='t';
  578. }
  579. }
  580. if(findstudent!='t')
  581. {
  582. gotoxy(10,10);
  583. printf("No record is found modify the search");
  584. if(getch())
  585. mainmenu();
  586. }
  587. if(findstudent=='t' )
  588. {
  589. gotoxy(10,9);
  590. printf("Do you want to delete it?(Y/N):");
  591. if(getch()=='y')
  592. {
  593. ft=fopen("sdel.dat.","wb+"); //temporary file for delete
  594. rewind(fs);
  595. while(fread(&stud,sizeof(stud),1,fs)==1)
  596. {
  597. if(stud.sid!=d)
  598. {
  599. fseek(ft,0,SEEK_CUR);
  600. fwrite(&stud,sizeof(stud),1,ft); //write all in tempory file except that
  601. } //we want to delete
  602. }
  603. fclose(ft);
  604. fclose(fs);
  605. remove("student.dat");
  606. rename("sdel.dat","Bibek.dat"); //copy all item frtemporary file to fp except that
  607. fp=fopen("student.dat","rb+"); //we want to delete
  608. if(findstudent=='t')
  609. {
  610. gotoxy(10,10);
  611. printf("The record is sucessfully deleted");
  612. gotoxy(10,11);
  613. printf("Delete another record?(Y/N)");
  614. }
  615. }
  616. else
  617. mainmenu();
  618. fflush(stdin);
  619. another=getch();
  620. }
  621. }
  622. gotoxy(10,15);
  623. mainmenu();
  624. }
  625.  
  626.  
  627.  
  628. void search_lecturer(void)
  629.  
  630. {
  631.  
  632. system("cls");
  633. int d=0,i;
  634. printf("*****************************Search Teacher*********************************");
  635. gotoxy(20,10);
  636. printf("\xDB\xDB\xDB\xB2 1. Search By LID");
  637. gotoxy(20,14);
  638. printf("\xDB\xDB\xDB\xB2 2. Search By Name");
  639. gotoxy( 15,20);
  640. printf("Enter Your Choice");
  641. fp=fopen("lecturer.dat","rb+"); //open file for reading propose
  642. rewind(fp); //move pointer at the begining of file
  643. switch(getch())
  644. {
  645. case '1':
  646. {
  647. system("cls");
  648. gotoxy(25,4);
  649. printf("****Search Teacher By ID****");
  650. gotoxy(20,5);
  651. printf("Enter The Lecturer ID:");
  652. scanf("%d",&d);
  653. gotoxy(20,7);
  654. printf("Searching........");
  655. while(fread(&lect,sizeof(lect),1,fp)==1)
  656. {
  657. if(lect.lid==d) //checks whether a.id is equal to d or not
  658. {
  659. delay(2);
  660. gotoxy(20,7);
  661. printf("The lecturer found");
  662. gotoxy(20,8);
  663. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  664. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  665. gotoxy(20,9);
  666. printf("\xB2 First Name:%s",lect.fname);gotoxy(47,9);printf("\xB2");
  667. gotoxy(20,10);
  668. printf("\xB2 Last Name:%s",lect.lname);gotoxy(47,10);printf("\xB2");
  669. gotoxy(20,11);
  670. printf("\xB2 Address:%s ",lect.address);gotoxy(47,11);printf("\xB2");
  671. gotoxy(20,12);
  672. printf("\xB2 Faculty:%s ",lect.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  673. gotoxy(20,13);
  674. printf("\xB2 Phone No.:%d",lect.phoneno);gotoxy(47,13);printf("\xB2");
  675. gotoxy(20,14);
  676. printf("\xB2 LID:%d ",lect.lid);gotoxy(47,14);printf("\xB2");
  677. gotoxy(20,15);
  678. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  679. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  680. findlecturer='t';
  681. }
  682.  
  683. }
  684. if(findlecturer!='t') //checks whether conditiion enters inside loop or not
  685. {
  686. gotoxy(20,8);
  687. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  688. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  689. gotoxy(20,10);
  690. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  691. gotoxy(22,9);printf("\aNo Record Found");
  692. }
  693. gotoxy(20,17);
  694. printf("Try another search?(Y/N)");
  695. if(getch()=='y')
  696. search_lecturer();
  697. else
  698. mainmenu();
  699. break;
  700. }
  701. case '2':
  702. {
  703. char s[25];
  704. system("cls");
  705. gotoxy(25,4);
  706. printf("****Search Lecturer By Name****");
  707. gotoxy(20,5);
  708. printf("Enter Lecturer First Name:");
  709. scanf("%s",s);
  710. int d=0;
  711. while(fread(&lect,sizeof(lect),1,fp)==1)
  712. {
  713. if(strcmp(lect.fname,(s))==0) //checks whether a.name is equal to s or not
  714. {
  715. gotoxy(20,7);
  716. printf("The Lecturer found");
  717. gotoxy(20,8);
  718. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  719. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  720. gotoxy(20,9);
  721. printf("\xB2 First Name:%s",lect.fname);gotoxy(47,9);printf("\xB2");
  722. gotoxy(20,10);
  723. printf("\xB2 Last Name:%s",lect.lname);gotoxy(47,10);printf("\xB2");
  724. gotoxy(20,11);
  725. printf("\xB2 Address:%s ",lect.address);gotoxy(47,11);printf("\xB2");
  726. gotoxy(20,12);
  727. printf("\xB2 Faculty:%s ",lect.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  728. gotoxy(20,13);
  729. printf("\xB2 Phone No.:%d",lect.phoneno);gotoxy(47,13);printf("\xB2");
  730. gotoxy(20,14);
  731. printf("\xB2 LID:%d ",lect.lid);gotoxy(47,14);printf("\xB2");
  732. gotoxy(20,15);
  733. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  734. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  735. d++;
  736. }
  737.  
  738. }
  739. if(d==0)
  740. {
  741. gotoxy(20,8);
  742. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  743. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  744. gotoxy(20,10);
  745. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  746. gotoxy(22,9);printf("\aNo Lecturer Found");
  747. }
  748. gotoxy(20,17);
  749. printf("Try another search?(Y/N)");
  750. if(getch()=='y')
  751. search_lecturer();
  752. else
  753. mainmenu();
  754. break;
  755. }
  756.  
  757. default :
  758. getch();
  759. search_lecturer();
  760. fclose(fp);
  761. }
  762. }
  763.  
  764. void search_student()
  765. {
  766. system("cls");
  767. int d;
  768. printf("*****************************Search Students*********************************");
  769. gotoxy(20,10);
  770. printf("\xDB\xDB\xDB\xB2 1. Search By SID");
  771. gotoxy(20,14);
  772. printf("\xDB\xDB\xDB\xB2 2. Search By Name");
  773. gotoxy( 15,20);
  774. printf("Enter Your Choice");
  775. fs=fopen("student.dat","rb+"); //open file for reading propose
  776. rewind(fs); //move pointer at the begining of file
  777. switch(getch())
  778. {
  779. case '1':
  780. {
  781. system("cls");
  782. gotoxy(25,4);
  783. printf("****Search Student By SID****");
  784. gotoxy(20,5);
  785. printf("Enter the student id:");
  786. scanf("%d",&d);
  787. gotoxy(20,7);
  788. printf("Searching........");
  789. while(fread(&stud,sizeof(stud),1,fs)==1)
  790. {
  791. if(stud.sid==d)
  792. {
  793. delay(2);
  794. gotoxy(20,7);
  795. printf("The student found");
  796. gotoxy(20,8);
  797. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  798. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  799. gotoxy(20,9);
  800. printf("\xB2 First Name:%s",stud.fname);gotoxy(47,9);printf("\xB2");
  801. gotoxy(20,10);
  802. printf("\xB2 Last Name:%s",stud.lname);gotoxy(47,10);printf("\xB2");
  803. gotoxy(20,11);
  804. printf("\xB2 Address:%s ",stud.address);gotoxy(47,11);printf("\xB2");
  805. gotoxy(20,12);
  806. printf("\xB2 Faculty:%s ",stud.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  807. gotoxy(20,13);
  808. printf("\xB2 Phone No.:%d",stud.phoneno);gotoxy(47,13);printf("\xB2");
  809. gotoxy(20,14);
  810. printf("\xB2 SID:%d ",stud.sid);gotoxy(47,14);printf("\xB2");
  811. gotoxy(20,15);
  812. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  813. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  814. findstudent='t';
  815. }
  816.  
  817. }
  818. if(findstudent!='t') //checks whether conditiion enters inside loop or not
  819. {
  820. gotoxy(20,8);
  821. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  822. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  823. gotoxy(20,10);
  824. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  825. gotoxy(22,9);printf("\aNo Record Found");
  826. }
  827. gotoxy(20,17);
  828. printf("Try another search?(Y/N)");
  829. if(getch()=='y')
  830. search_student();
  831. else
  832. mainmenu();
  833. break;
  834. }
  835.  
  836. case '2':
  837. {
  838. char s[15];
  839. system("cls");
  840. gotoxy(25,4);
  841. printf("****Search Student By First Name****");
  842. gotoxy(20,5);
  843. printf("Enter Student Name:");
  844. scanf("%s",s);
  845. int d=0;
  846. while(fread(&stud,sizeof(stud),1,fs)==1)
  847. {
  848. if(strcmp(stud.fname,(s))==0) //checks whether a.name is equal to s or not
  849. {
  850. gotoxy(20,7);
  851. printf("The Student found");
  852. gotoxy(20,8);
  853. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  854. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  855. gotoxy(20,9);
  856. printf("\xB2 First Name:%s",stud.fname);gotoxy(47,9);printf("\xB2");
  857. gotoxy(20,10);
  858. printf("\xB2 Last Name:%s",stud.lname);gotoxy(47,10);printf("\xB2");
  859. gotoxy(20,11);
  860. printf("\xB2 Address:%s ",stud.address);gotoxy(47,11);printf("\xB2");
  861. gotoxy(20,12);
  862. printf("\xB2 Faculty:%s ",stud.faculty);gotoxy(47,12);printf("\xB2"); gotoxy(47,11);printf("\xB2");
  863. gotoxy(20,13);
  864. printf("\xB2 Phone No.:%d",stud.phoneno);gotoxy(47,13);printf("\xB2");
  865. gotoxy(20,14);
  866. printf("\xB2 SID:%d ",stud.sid);gotoxy(47,14);printf("\xB2");
  867. gotoxy(20,15);
  868. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  869. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  870. d++;
  871. }
  872.  
  873. }
  874. if(d==0)
  875. {
  876. gotoxy(20,8);
  877. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  878. gotoxy(20,9);printf("\xB2"); gotoxy(38,9);printf("\xB2");
  879. gotoxy(20,10);
  880. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  881. gotoxy(22,9);printf("\aNo Student Found");
  882. }
  883. gotoxy(20,17);
  884. printf("Try another search?(Y/N)");
  885. if(getch()=='y')
  886. search_student();
  887. else
  888. mainmenu();
  889. break;
  890. }
  891. default :
  892. getch();
  893. search_student();
  894.  
  895. fclose(fs);
  896. }
  897. }
  898. void modify_lecturer(void) //edit information about book
  899. {
  900. system("cls");
  901. int c=0;
  902. int d,e;
  903. gotoxy(20,4);
  904. printf("****Modify Lecturer Section****");
  905. char another='y';
  906. while(another=='y')
  907. {
  908. system("cls");
  909. gotoxy(15,6);
  910. printf("Enter Lecturer Id to be edited:");
  911. scanf("%d",&d);
  912. fp=fopen("lecturer.dat","rb+");
  913. while(fread(&lect,sizeof(lect),1,fp)==1)
  914. {
  915. if(checklid(d)==0)
  916. {
  917. gotoxy(15,7);
  918. printf("The Lecturer is availble");
  919. gotoxy(15,8);
  920. printf("The Lecturer ID:%s",lect.lid);
  921. gotoxy(15,9);
  922. printf("Enter new first name:");scanf("%s",lect.fname);
  923. gotoxy(15,10);
  924. printf("Enter new last name:");scanf("%s",lect.lname);
  925. gotoxy(15,11);
  926. printf("Enter new Address:");scanf("%s",lect.address);
  927. gotoxy(15,12);
  928. printf("Enter new phone no.:");scanf("%d",&lect.phoneno);
  929. gotoxy(15,13);
  930. printf("Enter new LID:");scanf("%d",&lect.lid);
  931. gotoxy(15,14);
  932. printf("The record is modified");
  933. fseek(fp,ftell(fp)-sizeof(lect),0);
  934. fwrite(&lect,sizeof(lect),1,fp);
  935. fclose(fp);
  936. c=1;
  937. }
  938. if(c==0)
  939. {
  940. gotoxy(15,9);
  941. printf("No record found");
  942. }
  943. }
  944. gotoxy(15,16);
  945. printf("Modify another Record?(Y/N)");
  946. fflush(stdin);
  947. another=getch() ;
  948. }
  949. returnlect();
  950. }
  951.  
  952. void modify_student(void) //edit information about book
  953. {
  954. system("cls");
  955. int c=0;
  956. int d,e;
  957. gotoxy(20,4);
  958. printf("****Modify Student Section****");
  959. char another='y';
  960. while(another=='y')
  961. {
  962. system("cls");
  963. gotoxy(15,6);
  964. printf("Enter Student Id to be edited:");
  965. scanf("%d",&d);
  966. fs=fopen("student.dat","rb+");
  967. while(fread(&stud,sizeof(stud),1,fs)==1)
  968. {
  969. if(checksid(d)==0)
  970. {
  971. gotoxy(15,7);
  972. printf("The Student is availble");
  973. gotoxy(15,8);
  974. printf("The Student ID:%s",stud.sid);
  975. gotoxy(15,9);
  976. printf("Enter new first name:");scanf("%s",stud.fname);
  977. gotoxy(15,10);
  978. printf("Enter new last name:");scanf("%s",stud.lname);
  979. gotoxy(15,11);
  980. printf("Enter new Address:");scanf("%s",stud.address);
  981. gotoxy(15,12);
  982. printf("Enter new phone no.:");scanf("%d",&stud.phoneno);
  983. gotoxy(15,13);
  984. printf("Enter new SID:");scanf("%d",&stud.sid);
  985. gotoxy(15,14);
  986. printf("The record is modified");
  987. fseek(fs,ftell(fs)-sizeof(stud),0);
  988. fwrite(&stud,sizeof(stud),1,fs);
  989. fclose(fs);
  990. c=1;
  991. }
  992. if(c==0)
  993. {
  994. gotoxy(15,9);
  995. printf("No record found");
  996. }
  997. }
  998. gotoxy(15,16);
  999. printf("Modify another Record?(Y/N)");
  1000. fflush(stdin);
  1001. another=getch() ;
  1002. }
  1003. returnstud();
  1004. }
  1005.  
  1006. void lectureroption()
  1007. {
  1008. system("cls");
  1009. int i;
  1010.  
  1011. printf("\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2 LECTURER PANEL");
  1012. printf(" \xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2\xB2");
  1013. gotoxy(20,5);
  1014. printf("\xDB\xDB\xDB\xDB\xB2 1. View student");
  1015. gotoxy(20,7);
  1016. printf("\xDB\xDB\xDB\xDB\xB2 2. Mark attendance");
  1017. gotoxy(20,9);
  1018. printf("\xDB\xDB\xDB\xDB\xB2 3. Modify attendance");
  1019. gotoxy(20,11);
  1020. printf("------------------------------------------");
  1021. gotoxy(20,12);
  1022. t();
  1023. gotoxy(20,13);
  1024. printf("Enter your choice:");
  1025. switch(getch())
  1026. {
  1027. case '1':
  1028. take_attendance();
  1029. break;
  1030.  
  1031. case '2':
  1032. view_attendance();
  1033. break;
  1034.  
  1035. case '3':
  1036. modify_attendance();
  1037. break;
  1038.  
  1039. default:
  1040. {
  1041. gotoxy(10,23);
  1042. printf("\aWrong Entry!!Please re-entered correct option");
  1043. if(getch())
  1044. lectureroption();
  1045. }
  1046. }
  1047. }
  1048.  
  1049. void view_attendance(){
  1050. FILE *f = NULL;
  1051. char ch[10000];
  1052. printf("\n\n=================ATTENDANCE LIST=================\n\n");
  1053. printf("ATTENDANCE ID, STUDENT ID, DATE, START TIME, END TIME, MODULE, INTAKE CODE, ATTENDANCE STATUS\n");
  1054. printf("------------------------------------------------------------------------------------\n");
  1055. f = fopen("attendance.dat", "r");
  1056. if (f == NULL){
  1057. printf("Could not open file %s","attendance.dat");
  1058. }else{
  1059. while (EOF != fscanf(f, "%10000[^\n]\n", ch))
  1060. {
  1061. printf("> %s\n", ch);
  1062. }
  1063. fclose(f);
  1064. }
  1065. }
  1066.  
  1067. void take_attendance() {
  1068. struct Attendance attendance;
  1069. int noOfStudents = 0;
  1070. int index = 0, loop, attendance_status;
  1071. FILE *f = NULL;
  1072. attendance.id = rand();
  1073. view_student();
  1074. printf("Enter Number of Students:");
  1075. scanf("%d", &noOfStudents);
  1076. while (noOfStudents > index){
  1077. printf("Enter Student Id:\n");
  1078. scanf("%d", &attendance.student_id);
  1079. printf("Enter Lecture Date (Ex. 2018-01-14):\n");
  1080. scanf("%s", attendance.lectured_date);
  1081. printf("Enter Start Time(Ex. 6:30):\n");
  1082. scanf("%s", attendance.start_time);
  1083. printf("Enter End Time(Ex. 7:30):\n");
  1084. scanf("%s", attendance.end_time);
  1085. printf("Enter Module Name:\n");
  1086. scanf("%c",&temp);
  1087. scanf("%[^\n]", attendance.module_name);
  1088. printf("Enter Intake Code:\n");
  1089. scanf("%s", attendance.intake_code);
  1090. loop = 0;
  1091. while (loop == 0){
  1092. printf("Choose Attendance Status:\n");
  1093. printf("1. Present\n");
  1094. printf("2. Absent\n");
  1095. printf("3. Late\n");
  1096. scanf("%d", &attendance_status);
  1097. switch (attendance_status){
  1098. case 1:
  1099. strcpy(attendance.status, "Present");
  1100. loop = 1;
  1101. break;
  1102. case 2:
  1103. strcpy(attendance.status, "Absent");
  1104. loop = 1;
  1105. break;
  1106. case 3:
  1107. strcpy(attendance.status, "Late");
  1108. loop = 1;
  1109. break;
  1110. default:
  1111. continue;
  1112. }
  1113. }
  1114. f = fopen("attendance.dat", "a");
  1115. fprintf(f, "%d,%d,%s,%s,%s,%s,%s,%s\n", attendance.id, attendance.student_id, attendance.lectured_date, attendance.start_time,
  1116. attendance.end_time, attendance.module_name, attendance.intake_code, attendance.status);
  1117. printf("Attendance Recorded Successfully.\n");
  1118. fclose(f);
  1119. index++;
  1120. }
  1121.  
  1122.  
  1123. }
  1124.  
  1125. void modify_attendance(){
  1126. FILE *f = NULL, *ftemp = NULL;
  1127. char ch[10000], ch_copy[10000], *pt, c, temp_file[] = "temp_attendance.txt";
  1128. int index = 0, found = 0;
  1129. struct Attendance attendance;
  1130. int loop, attendance_status;
  1131. printf("Enter Attendance Id:\n");
  1132. scanf("%d", &attendance.id);
  1133.  
  1134.  
  1135. printf("Please Enter New Attendance Details:\n");
  1136. printf("Enter Student Id:\n");
  1137. scanf("%d", &attendance.student_id);
  1138. printf("Enter Lecture Date (Ex. 2018-01-14):\n");
  1139. scanf("%s", attendance.lectured_date);
  1140. printf("Enter Start Time(Ex. 6:30):\n");
  1141. scanf("%s", attendance.start_time);
  1142. printf("Enter End Time(Ex. 7:30):\n");
  1143. scanf("%s", attendance.end_time);
  1144. printf("Enter Module Name:\n");
  1145. scanf("%c",&temp);
  1146. scanf("%[^\n]", attendance.module_name);
  1147. printf("Enter Intake Code:\n");
  1148. scanf("%s", attendance.intake_code);
  1149. loop = 0;
  1150. while (loop == 0){
  1151. printf("Choose Attendance Status:\n");
  1152. printf("1. Present\n");
  1153. printf("2. Absent\n");
  1154. printf("3. Late\n");
  1155. scanf("%d", &attendance_status);
  1156. switch (attendance_status){
  1157. case 1:
  1158. strcpy(attendance.status, "Present");
  1159. loop = 1;
  1160. break;
  1161. case 2:
  1162. strcpy(attendance.status, "Absent");
  1163. loop = 1;
  1164. break;
  1165. case 3:
  1166. strcpy(attendance.status, "Late");
  1167. loop = 1;
  1168. break;
  1169. default:
  1170. continue;
  1171. }
  1172. }
  1173. f = fopen("attendance.dat", "r");
  1174. ftemp = fopen(temp_file, "w");
  1175. if (f == NULL) {
  1176. printf("Could not open file %s", "attendance.dat");
  1177. } else {
  1178. while (EOF != fscanf(f, "%10000[^\n]\n", ch)) {
  1179. index = 0, found = 0;
  1180. strcpy(ch_copy, ch);
  1181. pt = strtok(ch_copy, ",");
  1182. while (pt != NULL) {
  1183. if (index == 0) {
  1184. int attendance_id = atoi(pt);
  1185. if (attendance_id == attendance.id) {
  1186. found = 1;
  1187. break;
  1188. }
  1189. }
  1190. pt = strtok(NULL, ",");
  1191. index++;
  1192. }
  1193. if (found == 0) {
  1194. fprintf(ftemp, "%s\n", ch);
  1195. } else {
  1196. fprintf(ftemp, "%d,%d,%s,%s,%s,%s,%s,%s\n", attendance.id, attendance.student_id, attendance.lectured_date, attendance.start_time,
  1197. attendance.end_time, attendance.module_name, attendance.intake_code, attendance.status);
  1198. }
  1199. }
  1200. fclose(f);
  1201. fclose(ftemp);
  1202. remove("attendance.dat");
  1203.  
  1204. f = fopen("attendance", "a");
  1205. ftemp = fopen(temp_file, "r");
  1206.  
  1207. c = fgetc(ftemp);
  1208. while (c != EOF) {
  1209. fputc(c, f);
  1210. c = fgetc(ftemp);
  1211. }
  1212. fclose(f);
  1213. fclose(ftemp);
  1214. remove(temp_file);
  1215. }
  1216. }
  1217.  
  1218. int checklid(int t) //check whether the lecturer exist in or not
  1219. {
  1220. rewind(fp);
  1221. while(fread(&lect,sizeof(lect),1,fp)==1)
  1222. if(lect.lid==t)
  1223. return 0; //returns 0 if lecturer exits
  1224. return 1; //return 1 if doesnot exxist
  1225. }
  1226.  
  1227.  
  1228. int checksid(int t) //check whether the student exist or not
  1229. {
  1230. rewind(fs);
  1231. while(fread(&stud,sizeof(stud),1,fs)==1)
  1232. if(stud.sid==t)
  1233. return 0; //returns 0 if student exits
  1234. return 1; //return 1 if doesnot exist
  1235. }
  1236.  
  1237. void returnlect(void)
  1238. {
  1239. printf(" Press ENTER to return to main menu");
  1240. lect:
  1241. if(getch()==13) //allow only use of enter
  1242. mainmenu();
  1243. else
  1244. goto lect;
  1245. }
  1246.  
  1247. void returnstud(void)
  1248. {
  1249.  
  1250. printf(" Press ENTER to return to main menu");
  1251. stud:
  1252. if(getch()==13) //allow only use of enter
  1253. mainmenu();
  1254. else
  1255. goto stud;
  1256. }
  1257. int t(void) //for time
  1258. {
  1259. time_t t;
  1260. time(&t);
  1261. printf("Date and time:%s\n",ctime(&t));
  1262.  
  1263. return 0 ;
  1264. }
  1265.  
  1266.  
  1267. void Password(void) //for password option
  1268. {
  1269.  
  1270. system("cls");
  1271. printf("\n\n=================WELCOME TO THE ATTENDANCE MANAGEMENT SYSTEM=================\n\n\n");
  1272. char d[25]="Password Protected";
  1273. char ch,pass[10];
  1274. int i=0,j;
  1275. //textbackground(WHITE);
  1276. //textcolor(RED);
  1277. gotoxy(10,4);
  1278. for(j=0;j<20;j++)
  1279.  
  1280. {
  1281. delay(5);
  1282. printf("*");
  1283. }
  1284.  
  1285. for(j=0;j<20;j++)
  1286.  
  1287. {
  1288. delay(5);
  1289. printf("%c",d[j]);
  1290. }
  1291.  
  1292. for(j=0;j<20;j++)
  1293. {
  1294. delay(5);
  1295. printf("*");
  1296. }
  1297.  
  1298. gotoxy(10,10);
  1299. gotoxy(15,7);
  1300. printf("Enter Password:");
  1301.  
  1302. while(ch!=13)
  1303. {
  1304. ch=getch();
  1305.  
  1306. if(ch!=13 && ch!=8)
  1307. {
  1308. putch('*');
  1309. pass[i] = ch;
  1310. i++;
  1311. }
  1312. }
  1313. pass[i] = '\0';
  1314. if(strcmp(pass,password)==0)
  1315.  
  1316. {
  1317. gotoxy(15,9);
  1318. //textcolor(BLINK);
  1319. printf("Password match");
  1320. gotoxy(17,10);
  1321. printf("Press any key to countinue.....");
  1322. getch();
  1323. mainmenu();
  1324. }
  1325. else
  1326.  
  1327. {
  1328. gotoxy(15,16);
  1329. printf("\aWarning!! Incorrect Password");
  1330. getch();
  1331. Password();
  1332. }
  1333. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement