fork download
  1. #include<graphics.h>
  2. #include<dos.h>
  3. #include<stdlib.h>
  4. #include<iostream.h>
  5. #include<conio.h>
  6. #include<string.h>
  7. #include<process.h>
  8. #include<fstream.h>
  9. #include<dir.h>
  10. #include<stdio.h>
  11.  
  12. #define xy(z) (8*(z-1))
  13.  
  14. // GLOBAL Funcions
  15.  
  16. void grap();
  17. void intro();
  18. void box();
  19. void mainwindow();
  20. void faculty();
  21. void student();
  22. void enterdata();
  23. void personaldetial();
  24. void admindetails(char *name);
  25. void seeyearfaculty();
  26. void fullaccessfaculty();
  27. void modifyfaculty();
  28. void deletefaculty();
  29. void prin();
  30. void enterdatast();
  31. void personalst();
  32. void academic(char *name);
  33. void seetotalst();
  34. void fullaccessst();
  35. void modifyst();
  36. void deletest();
  37. void encrypt(char *name);
  38. void closeprog();
  39. void quit();
  40. void typeme(int left,int top,const char *word,int interval);
  41.  
  42. // GLOBAL Variables
  43.  
  44.  
  45. int option,pass,i,access,x,y,status;
  46.  
  47. char year[10],ch,name[100],temp[200],newfile[100],a[50],mod;
  48.  
  49. void *p;
  50.  
  51. size_t area;
  52.  
  53. void main()
  54. {
  55. grap();
  56. a:clearviewport();
  57. i=0;
  58.  
  59. rectangle(getmaxx()/2-140,getmaxy()/2-20,getmaxx()/2+135,getmaxy()/2+4);
  60. outtextxy(getmaxx()/2-127,getmaxy()/2-12,"Enter Accesscode:");
  61. gotoxy(43,15);
  62.  
  63.  
  64. //Password Code
  65.  
  66.  
  67. do
  68. {
  69. pass=getch();
  70. if(pass==13) goto b;
  71. a[i]=char(pass);
  72. cout<<"*";
  73. sound(500);delay(100);nosound();
  74. i++;
  75. }while(pass!=13);
  76.  
  77. b:a[i]=0;
  78. access=stricmp(a,"nopassword");
  79.  
  80. if(access==0)
  81. {
  82. cout<<"
  83. Access Granted ..
  84. Press Any Key To Continue.......";
  85. intro();
  86. textcolor(BLACK);
  87. textbackground(YELLOW);
  88. mainwindow();
  89. }
  90.  
  91. else
  92. {
  93. clearviewport();
  94. cout<<"
  95. Unautorised Access ";
  96. cout<<"
  97. Press Any Key To Continue......... ";
  98. getch();
  99. goto a;
  100. }
  101. }
  102.  
  103. // INTRODUCTION SCREEN
  104.  
  105. void intro()
  106. {
  107. int a,b,c,d;
  108. setfillstyle(8,1);
  109.  
  110. for(a=0,b=getmaxx(),c=getmaxx()/2,d=getmaxx()/2;a<getmaxx()/2+3;a+=5,b-=5,
  111. c-=5,d+=5)
  112.  
  113. {
  114. line(c,xy(8),d,xy(8));line(c,xy(51),d,xy(51));
  115. bar(0,xy(9),a,xy(50));bar(b,xy(9),getmaxx(),xy(50));
  116. sound(10*(a+250));delay(10);
  117. }
  118.  
  119. nosound();
  120. char pattern[] ={0xfe,0xbc,0xda,0xe4,0xe2,0xc0,0x88,0x00};
  121. setfillpattern(pattern,1);
  122. bar(0,0,640,480);
  123. settextstyle(1,0,5);
  124. setcolor(10);
  125. outtextxy(100,140,"INSTITUTE MANAGEMENT");
  126. outtextxy(250,200,"SYSTEM");
  127. getch();
  128. setcolor(0);
  129.  
  130. for(i=0;i<=320;i++)
  131. {
  132. rectangle(0+i,0,640-i,480);
  133. delay(5);
  134. }
  135.  
  136. closegraph();
  137. }
  138.  
  139.  
  140. // DETECTION OF GRAPHICS
  141.  
  142. void grap()
  143. {
  144. int gd= DETECT, gm, errorcode;
  145. initgraph(&gd, &gm, "c:\tc\bgi");
  146. errorcode = graphresult();
  147.  
  148.  
  149. if(errorcode != grOk)
  150. {
  151. printf("Graphics error: %s
  152. ", grapherrormsg(errorcode));
  153. exit(1);
  154. }
  155.  
  156. }
  157.  
  158. // FUNCTION TO DRAW A BOX
  159.  
  160. void box(void)
  161. {
  162. int i,x,y;
  163. gotoxy(11,2);
  164.  
  165. for(i=1; i<=58; i++)
  166. {
  167. putch(196);
  168. }
  169.  
  170. gotoxy(11,6);
  171.  
  172. for(i=1; i<=58; i++)
  173. {
  174. putch(196);
  175. }
  176.  
  177. gotoxy(68,2);
  178. putch(191);
  179. y=3;
  180.  
  181. for(i=1; i<=21; i++)
  182. {
  183. gotoxy(68,y);
  184. y++;
  185. putch(179);
  186. }
  187.  
  188. gotoxy(68,24);
  189. putch(217);
  190. gotoxy(11,24);
  191.  
  192. for(i=1; i<=57; i++)
  193. {
  194. putch(196);
  195. }
  196.  
  197. gotoxy(11,24);
  198. putch(192);
  199. y=3;
  200.  
  201. for(i=1; i<=21; i++)
  202. {
  203. gotoxy(11,y);
  204. y++;
  205. putch(179);
  206. }
  207.  
  208. gotoxy(11,2);
  209. putch(218);
  210.  
  211. }
  212.  
  213.  
  214. // Main Window Function
  215.  
  216. void mainwindow()
  217. {
  218. clrscr();
  219. box();
  220.  
  221. gotoxy(26,4);cout<<"INSTITUTE MANAGEMENT SYSTEM ";
  222. gotoxy(26,5);cout<<"===========================";
  223. gotoxy(26,8);cout<<"Choose Your Option .......";
  224. gotoxy(26,10);cout<<"1. Faculty Informaton ";
  225. gotoxy(26,12);cout<<"2. Students Information ";
  226. gotoxy(26,14);cout<<"3. Print Any Information ";
  227. gotoxy(26,16);cout<<"Press 0 To Exit
  228. ";
  229. gotoxy(26,18);cout<<"Option -----> ";
  230.  
  231. cin>>option;
  232.  
  233. switch(option)
  234. {
  235. case 1 : faculty();
  236. break;
  237.  
  238. case 2 : student();
  239. break;
  240.  
  241. case 3 : prin();
  242. break;
  243.  
  244. default : closeprog();
  245. break;
  246. };
  247. }
  248.  
  249.  
  250. // FUNCTION FOR SHOWING A MAIN WINDOW OF FACULTY INFORMATION
  251.  
  252. void faculty()
  253. {
  254. clrscr();
  255. box();
  256.  
  257. gotoxy(26,4);cout<<"INSTITUTE MANAGEMENT SYSTEM ";
  258. gotoxy(26,5);cout<<"===========================";
  259. gotoxy(26,8);cout<<"Choose You Option........";
  260. gotoxy(26,10);cout<<"1. Add A New Record ";
  261. gotoxy(26,12);cout<<"2. See All Faculty's ";
  262. gotoxy(26,14);cout<<"3. Full Access To Any Faculty Information ";
  263. gotoxy(26,16);cout<<"4. Modify Any Information ";
  264. gotoxy(26,18);cout<<"5. Delete Any Information ";
  265. gotoxy(26,20);cout<<"Press 0 To Exit....... ";
  266. gotoxy(26,22);cout<<"Option------> ";
  267.  
  268. cin>>option;
  269.  
  270. switch(option)
  271. {
  272. case 1 : enterdata();
  273. break;
  274.  
  275. case 2 : seeyearfaculty();
  276. break;
  277.  
  278. case 3 : fullaccessfaculty();
  279. break;
  280.  
  281. case 4 : modifyfaculty();
  282. break;
  283.  
  284. case 5 : deletefaculty();
  285. break;
  286.  
  287. default : closeprog();
  288. break;
  289. };
  290. }
  291.  
  292.  
  293. // FUNCTION TO INSERT A DATA OF FACULTY
  294.  
  295. void enterdata()
  296. {
  297. clrscr();
  298.  
  299. cout<<"
  300.  
  301. Enter The Year Which you Want To Add The Data ";
  302. cout<<"
  303. ============================================= ";
  304. gets(year);
  305.  
  306. mkdir("data");
  307. chdir("data");
  308. mkdir("faculty");
  309. chdir("faculty");
  310. mkdir(year);
  311. chdir(year);
  312.  
  313. cout<<"
  314. Enter The Faculty Name : ";
  315. gets(name);
  316.  
  317. mkdir(name);
  318. chdir(name);
  319.  
  320. personaldetial();
  321. chdir("\");
  322. mainwindow();
  323. }
  324.  
  325.  
  326. // FUNCTION TO ENTER A PERSONAL DETAILS OF A FACULTY
  327.  
  328. void personaldetial()
  329. {
  330. cout<<"
  331.  
  332. Enter The Personal Details ";
  333. cout<<"
  334. ========================== ";
  335. cout<<"
  336.  
  337. Enter The The Name Of A Person : ";
  338. gets(name);
  339.  
  340. mkdir(name);
  341. chdir(name);
  342.  
  343. strcpy(newfile,"p");
  344. strcat(newfile,name);
  345. strcat(newfile,".txt");
  346. ofstream fout(newfile);
  347.  
  348. if(!fout)
  349. {
  350. clrscr();
  351. perror("
  352.  
  353.  
  354.  
  355.  
  356. Cannot Open The File ");
  357. cout<<"
  358.  
  359. PRESS ANY KEY TO Return To Main Menu ";
  360. getch();
  361. chdir("\");
  362. mainwindow();
  363. }
  364.  
  365. fout<<"NAME : "<<name;
  366.  
  367. cout<<"
  368. Enter The Address : ";
  369. gets(temp);
  370.  
  371. fout<<"
  372. ADDRESS :"<<temp;
  373.  
  374. cout<<"
  375. Enter Contact No. : ";
  376. gets(temp);
  377.  
  378. fout<<"
  379. CONTACT No. :"<<temp;
  380.  
  381. fout.close();
  382. encrypt(newfile);
  383. admindetails(name);
  384. }
  385.  
  386.  
  387. // FUNCTION TO ENTER A ADMINISTRATION DETAILS OF A FACULTY
  388.  
  389.  
  390. void admindetails(char *name)
  391. {
  392. clrscr();
  393.  
  394. cout<<"
  395.  
  396. Enter The Administration Detials ";
  397. cout<<"
  398. ================================ ";
  399.  
  400. strcpy(newfile,"a");
  401. strcat(newfile,name);
  402. strcat(newfile,".txt");
  403.  
  404. ofstream foutt(newfile);
  405.  
  406. if(!foutt)
  407. {
  408. clrscr();
  409. perror("
  410.  
  411.  
  412.  
  413.  
  414. Cannot Open The File ");
  415. cout<<"
  416.  
  417. PRESS ANY KEY TO Return To Main Menu ";
  418. getch();
  419. chdir("\");
  420. mainwindow();
  421. }
  422.  
  423. foutt<<"NAME : "<<name;
  424.  
  425. cout<<"
  426.  
  427. Enter Educational Qualification :";
  428. gets(temp);
  429.  
  430. foutt<<"
  431. EDUCATIONAL QUALIFICATIONS :"<<temp;
  432.  
  433. cout<<"
  434. Enter The Name Of The Subjects Taught ";
  435. cout<<"
  436. ===================================== ";
  437.  
  438. foutt<<"
  439. SUBJECTS TAUGHT :";
  440.  
  441. cout<<"
  442.  
  443. Subject(s) Taught to First Year: ";
  444. gets(temp);
  445.  
  446. foutt<<"
  447.  
  448. First Year :"<<temp;
  449.  
  450. cout<<"
  451. Type Of Subject (Theory / Practical) :";
  452. gets(temp);
  453.  
  454. foutt<<"
  455. Type of Subject :"<<temp;
  456.  
  457. cout<<"
  458.  
  459. Subject(s) Taught to Second Year: ";
  460. gets(temp);
  461.  
  462. foutt<<"
  463.  
  464. Second Year :"<<temp;
  465.  
  466. cout<<"
  467. Type Of Subject (Theory / Practical) :";
  468. gets(temp);
  469.  
  470. foutt<<"
  471. Type of Subject :"<<temp;
  472.  
  473. cout<<"
  474.  
  475. Subject(s) Taught to Third Year: ";
  476. gets(temp);
  477.  
  478. foutt<<"
  479.  
  480. Third Year :"<<temp;
  481.  
  482. cout<<"
  483. Type Of Subject (Theory / Practical) :";
  484. gets(temp);
  485.  
  486. foutt<<"
  487. Type of Subject :"<<temp;
  488.  
  489. cout<<"
  490. Enter Type of Faculty (Permanent / Visiting)";
  491. gets(temp);
  492.  
  493. foutt<<"
  494. TYPE OF FACULTY :"<<temp;
  495.  
  496. foutt.close();
  497. encrypt(newfile);
  498.  
  499. }
  500.  
  501.  
  502. // FUNCTION TO ENCRYPT A DATA
  503.  
  504. void encrypt(char *newfile)
  505. {
  506. ofstream fout("temp.txt");
  507. ifstream fin(newfile);
  508.  
  509. while(fin)
  510. {
  511. fin.get(ch);
  512. if(ch==EOF)break;
  513. mod=~ch;
  514. fout<<mod;
  515. }
  516.  
  517. remove(newfile);
  518. rename("temp.txt",newfile);
  519. }
  520.  
  521.  
  522. // FUNCTION TO SEE THE TOTAL FACULTY OF A YEAR
  523.  
  524. void seeyearfaculty()
  525. {
  526. clrscr();
  527.  
  528. cout<<"
  529.  
  530. Enter The Year Of Which You Want To See The Faculties
  531.  
  532. ";
  533. gets(year);
  534.  
  535. chdir("data");
  536. chdir("faculty");
  537. chdir(year);
  538.  
  539. cout<<"
  540.  
  541. Enter The Faculty Name
  542. ";
  543. gets(name);
  544.  
  545. chdir(name);
  546.  
  547. clrscr();
  548.  
  549. cout<<"
  550.  
  551. ";
  552. cout<<"
  553.  
  554. These Are The Teachers Of A Stream
  555.  
  556. ";
  557.  
  558. system("dir /b /ad /w");
  559. getch();
  560. chdir("\");
  561. mainwindow();
  562. }
  563.  
  564.  
  565. // FUNCTION TO GET FULL ACCESS TO A PARTICULAR DATA
  566.  
  567. void fullaccessfaculty()
  568. {
  569. clrscr();
  570.  
  571. chdir("data");
  572. chdir("faculty");
  573.  
  574. cout<<"
  575.  
  576. Enter The Year Of The Faculty : ";
  577. gets(year);
  578.  
  579. chdir(year);
  580.  
  581. cout<<"
  582.  
  583. Enter The Name Of The Faculty : ";
  584. gets(name);
  585.  
  586. chdir(name);
  587.  
  588. cout<<"
  589.  
  590. Enter The Name Of A Person : ";
  591. gets(name);
  592.  
  593. chdir(name);
  594.  
  595. cout<<"
  596. What You Want To See Personal Information Or Admin
  597. Information
  598. ";
  599. cout<<"
  600. 1. Personal ";
  601. cout<<"
  602. 2. Adminstration ";
  603. cout<<"
  604.  
  605. Option------> ";
  606.  
  607. cin>>option;
  608.  
  609. clrscr();
  610.  
  611. cout<<"
  612.  
  613.  
  614. ";
  615.  
  616. if(option==1)
  617. {
  618. strcpy(newfile,"p");
  619. strcat(newfile,name);
  620. strcat(newfile,".txt");
  621.  
  622. ifstream fin(newfile);
  623.  
  624. if(!fin)
  625. {
  626. clrscr();
  627. perror("
  628.  
  629.  
  630.  
  631.  
  632. Cannot Open The File ");
  633. cout<<"
  634.  
  635. PRESS ANY KEY TO Return To Main Menu ";
  636. getch();
  637. chdir("\");
  638. mainwindow();
  639. }
  640.  
  641. while(fin.get(ch)!=0)
  642. {
  643. mod=~ch;
  644. cout<<mod;
  645. }
  646.  
  647. getch();
  648. fin.close();
  649. }
  650.  
  651. if(option==2)
  652. {
  653. strcpy(newfile,"a");
  654. strcat(newfile,name);
  655. strcat(newfile,".txt");
  656.  
  657. ifstream fin(newfile);
  658.  
  659. if(!fin)
  660. {
  661. clrscr();
  662. perror("
  663.  
  664.  
  665.  
  666.  
  667. Cannot Open The File ");
  668. cout<<"
  669.  
  670. PRESS ANY KEY TO Return To Main Menu ";
  671. getch();
  672. chdir("\");
  673. mainwindow();
  674. }
  675.  
  676. while(fin.get(ch)!=0)
  677. {
  678. mod=~ch;
  679. cout<<mod;
  680. }
  681.  
  682. getch();
  683. fin.close();
  684. }
  685.  
  686. chdir("\");
  687. mainwindow();
  688. }
  689.  
  690.  
  691. // FUNTION TO MODIFY A FACULTY DATA
  692.  
  693. void modifyfaculty()
  694. {
  695. clrscr();
  696.  
  697. chdir("data");
  698. chdir("faculty");
  699.  
  700. cout<<"
  701.  
  702. Enter The Year : ";
  703. gets(year);
  704.  
  705. chdir(year);
  706.  
  707. cout<<"
  708.  
  709. Enter The Name Of A Faculty : ";
  710. gets(name);
  711.  
  712. chdir(name);
  713.  
  714. cout<<"
  715.  
  716. Enter The Name Of A Person : ";
  717. gets(name);
  718.  
  719. status=rmdir(name);
  720.  
  721. if(status==0)
  722. {
  723. personaldetial();
  724. }
  725.  
  726. else
  727. {
  728. clrscr();
  729. perror("
  730.  
  731.  
  732.  
  733.  
  734. Cannot Open The File ");
  735. cout<<"
  736.  
  737. PRESS ANY KEY TO Return To Main Menu ";
  738. getch();
  739. chdir("\");
  740. mainwindow();
  741. }
  742.  
  743. chdir("\");
  744. mainwindow();
  745. }
  746.  
  747. // FUNTION FOR DELETING A FACULTY DATA
  748.  
  749. void deletefaculty()
  750. {
  751. clrscr();
  752.  
  753. chdir("data");
  754. chdir("faculty");
  755.  
  756. cout<<"
  757.  
  758. Enter The Year : ";
  759. gets(year);
  760.  
  761. chdir(year);
  762.  
  763. cout<<"
  764.  
  765.  
  766. Enter The Name Of A Faculty : ";
  767. gets(name);
  768.  
  769. chdir(name);
  770.  
  771. cout<<"
  772.  
  773. Enter The Name Of A Person : ";
  774. gets(name);
  775.  
  776. cout<<"
  777.  
  778. Are You Sure You Want To Remove It (y/n) : ";
  779. cin>>ch;
  780.  
  781. if(ch=='y')
  782. {
  783. status=rmdir(name);
  784.  
  785. if(status==0)
  786. {
  787. cout<<"
  788.  
  789. Record Have Been Removed Succesfully ";
  790. cout<<"
  791. Press Any Key To Return To Main Menu ";
  792. getch();
  793. chdir("\");
  794. mainwindow();
  795. }
  796.  
  797. else
  798. {
  799. clrscr();
  800. perror("
  801.  
  802.  
  803.  
  804.  
  805. Cannot Open The File ");
  806. cout<<"
  807.  
  808. PRESS ANY KEY TO Return To Main Menu ";
  809. getch();
  810. chdir("\");
  811. mainwindow();
  812. }
  813. }
  814.  
  815. else
  816. {
  817. chdir("\");
  818. mainwindow();
  819. }
  820. }
  821.  
  822.  
  823. // FUNCTION FOR PRINTING THE DATA
  824.  
  825. void prin()
  826. {
  827. clrscr();
  828.  
  829. cout<<"
  830. Enter The Option ";
  831. cout<<"
  832. 1. Faculty ";
  833. cout<<"
  834. 2. Student ";
  835. cout<<"
  836.  
  837. Option------> ";
  838. cin>>option;
  839.  
  840. chdir("data");
  841.  
  842. if(option==1)
  843. {
  844. chdir("faculty");
  845.  
  846. cout<<"
  847. Enter The Year ";
  848. gets(year);
  849.  
  850. chdir(year);
  851.  
  852. cout<<"
  853. Enter The Name Of Faculty ";
  854. gets(name);
  855.  
  856. chdir(name);
  857.  
  858. cout<<"
  859. Want Take A Print Document Of Personal Or Admin Details ";
  860. cout<<"
  861. 1. Personal ";
  862. cout<<"
  863. 2. Adminstration ";
  864. cout<<"
  865.  
  866. Option------> ";
  867.  
  868. cin>>option;
  869.  
  870. if(option==1)
  871. {
  872. strcpy(newfile,"p");
  873. strcat(newfile,name);
  874. strcat(newfile,".txt");
  875.  
  876. ifstream fin;
  877. fin.open(newfile);
  878.  
  879. if(!fin)
  880. {
  881. clrscr();
  882. perror("
  883.  
  884.  
  885.  
  886.  
  887. Cannot Open The File ");
  888. cout<<"
  889.  
  890. PRESS ANY KEY TO Return To Main Menu ";
  891. getch();
  892. chdir("\");
  893. mainwindow();
  894. }
  895.  
  896. ofstream fout;
  897. fout.open("PRN");
  898.  
  899. if(!fout)
  900. {
  901. clrscr();
  902. perror("
  903.  
  904.  
  905.  
  906.  
  907. Cannot Open The File ");
  908. cout<<"
  909.  
  910. PRESS ANY KEY TO Return To Main Menu ";
  911. getch();
  912. chdir("\");
  913. mainwindow();
  914. }
  915.  
  916. while(fin.get(ch)!=0)
  917. {
  918. mod=~ch;
  919. fout.put(mod);
  920. }
  921.  
  922. fout.close();
  923. fin.close();
  924. }
  925.  
  926. if(option==2)
  927. {
  928. strcpy(newfile,"a");
  929. strcat(newfile,name);
  930. strcat(newfile,".txt");
  931.  
  932. ifstream fin;
  933. fin.open(newfile);
  934.  
  935. if(!fin)
  936. {
  937. clrscr();
  938. perror("
  939.  
  940.  
  941.  
  942.  
  943. Cannot Open The File ");
  944. cout<<"
  945.  
  946. PRESS ANY KEY TO Return To Main Menu ";
  947. getch();
  948. chdir("\");
  949. mainwindow();
  950. }
  951.  
  952. ofstream fout;
  953. fout.open("PRN");
  954.  
  955. if(!fin)
  956. {
  957. clrscr();
  958. perror("
  959.  
  960.  
  961.  
  962.  
  963. Cannot Open The File ");
  964. cout<<"
  965.  
  966. PRESS ANY KEY TO Return To Main Menu ";
  967. getch();
  968. chdir("\");
  969. mainwindow();
  970. }
  971.  
  972. while(fin.get(ch)!=0)
  973. {
  974. mod=~ch;
  975. fout.put(mod);
  976. }
  977.  
  978. fout.close();
  979. fin.close();
  980. }
  981. }
  982.  
  983. if(option==2)
  984. {
  985. chdir("student");
  986.  
  987. cout<<"
  988. Enter The Year ";
  989. gets(year);
  990.  
  991. chdir(year);
  992.  
  993. cout<<"
  994. Enter The Name Of Student ";
  995. gets(name);
  996.  
  997. chdir(name);
  998.  
  999. cout<<"
  1000. Want Take A Print Document Of Personal Or Admin Details ";
  1001. cout<<"
  1002. 1. Personal ";
  1003. cout<<"
  1004. 2. Academic ";
  1005. cout<<"
  1006.  
  1007. Option------> ";
  1008.  
  1009. cin>>option;
  1010.  
  1011. if(option==1)
  1012. {
  1013. strcpy(newfile,"p");
  1014. strcat(newfile,name);
  1015. strcat(newfile,".txt");
  1016.  
  1017. ifstream fin;
  1018. fin.open(newfile);
  1019.  
  1020. if(!fin)
  1021. {
  1022. clrscr();
  1023. perror("
  1024.  
  1025.  
  1026.  
  1027.  
  1028. Cannot Open The File ");
  1029. cout<<"
  1030.  
  1031. PRESS ANY KEY TO Return To Main Menu ";
  1032. getch();
  1033. chdir("\");
  1034. mainwindow();
  1035. }
  1036.  
  1037. ofstream fout;
  1038. fout.open("PRN");
  1039.  
  1040. if(!fout)
  1041. {
  1042. clrscr();
  1043. perror("
  1044.  
  1045.  
  1046.  
  1047.  
  1048. Cannot Open The File ");
  1049. cout<<"
  1050.  
  1051. PRESS ANY KEY TO Return To Main Menu ";
  1052. getch();
  1053. chdir("\");
  1054. mainwindow();
  1055. }
  1056.  
  1057. while(fin.get(ch)!=0)
  1058. {
  1059. mod=~ch;
  1060. fout.put(mod);
  1061. }
  1062.  
  1063. fout.close();
  1064. fin.close();
  1065. }
  1066.  
  1067. if(option==2)
  1068. {
  1069. strcpy(newfile,"a");
  1070. strcat(newfile,name);
  1071. strcat(newfile,".txt");
  1072.  
  1073. ifstream fin;
  1074. fin.open(newfile);
  1075.  
  1076. if(!fin)
  1077. {
  1078. clrscr();
  1079. perror("
  1080.  
  1081.  
  1082.  
  1083.  
  1084. Cannot Open The File ");
  1085. cout<<"
  1086.  
  1087. PRESS ANY KEY TO Return To Main Menu ";
  1088. getch();
  1089. chdir("\");
  1090. mainwindow();
  1091. }
  1092.  
  1093. ofstream fout;
  1094. fout.open("PRN");
  1095.  
  1096. if(!fout)
  1097. {
  1098. clrscr();
  1099. perror("
  1100.  
  1101.  
  1102.  
  1103.  
  1104. Cannot Open The File ");
  1105. cout<<"
  1106.  
  1107. PRESS ANY KEY TO Return To Main Menu ";
  1108. getch();
  1109. chdir("\");
  1110. mainwindow();
  1111. }
  1112.  
  1113. while(fin.get(ch)!=0)
  1114. {
  1115. mod=~ch;
  1116. fout.put(mod);
  1117. }
  1118.  
  1119. fout.close();
  1120. fin.close();
  1121. }
  1122. }
  1123.  
  1124. chdir("\");
  1125. mainwindow();
  1126. }
  1127.  
  1128.  
  1129. // FUNCTION FOR SHOWING A MAIN WINDOW OF STUDENT INFORMATION
  1130.  
  1131. void student()
  1132. {
  1133. clrscr();
  1134. box();
  1135.  
  1136. gotoxy(26,4);cout<<"INSTITUTE MANAGEMENT SYSTEM ";
  1137. gotoxy(26,5);cout<<"===========================";
  1138. gotoxy(26,8);cout<<"Choose You Option........";
  1139. gotoxy(26,10);cout<<"1. Add A New Student Record ";
  1140. gotoxy(26,12);cout<<"2. See All Students ";
  1141. gotoxy(26,14);cout<<"3. Full Access To Any Student Information ";
  1142. gotoxy(26,16);cout<<"4. Modify Any Information ";
  1143. gotoxy(26,18);cout<<"5. Delete Any Information ";
  1144. gotoxy(26,20);cout<<"Press 0 To Exit....... ";
  1145. gotoxy(26,22);cout<<"Option------> ";
  1146.  
  1147. cin>>option;
  1148.  
  1149. switch(option)
  1150. {
  1151. case 1 : enterdatast();
  1152. break;
  1153.  
  1154. case 2 : seetotalst();
  1155. break;
  1156.  
  1157. case 3 : fullaccessst();
  1158. break;
  1159.  
  1160. case 4 : modifyst();
  1161. break;
  1162.  
  1163. case 5 : deletest();
  1164. break;
  1165.  
  1166. default : closeprog();
  1167. break;
  1168. };
  1169. }
  1170.  
  1171.  
  1172. // FUNCTION TO ENTER A STUDENT DATA
  1173.  
  1174. void enterdatast()
  1175. {
  1176. clrscr();
  1177.  
  1178. cout<<"
  1179.  
  1180. Enter The Year Which you Want To Add The Data ";
  1181. cout<<"
  1182. =============================================== ";
  1183. gets(year);
  1184.  
  1185. mkdir("data");
  1186. chdir("data");
  1187. mkdir("student");
  1188. chdir("student");
  1189. mkdir(year);
  1190. chdir(year);
  1191.  
  1192. personalst();
  1193. chdir("\");
  1194. mainwindow();
  1195. }
  1196.  
  1197.  
  1198. // FUNCTION TO ENTER A PERSONAL DETAILS OF A STUDENT
  1199.  
  1200. void personalst()
  1201. {
  1202. cout<<"
  1203.  
  1204. Enter The Personal Details ";
  1205. cout<<"
  1206. ========================== ";
  1207.  
  1208. cout<<"
  1209.  
  1210. Enter The The Name Of The Student : ";
  1211. gets(name);
  1212.  
  1213. mkdir(name);
  1214. chdir(name);
  1215.  
  1216. strcpy(newfile,"p");
  1217. strcat(newfile,name);
  1218. strcat(newfile,".txt");
  1219. ofstream fout(newfile);
  1220.  
  1221. if(!fout)
  1222. {
  1223. clrscr();
  1224. perror("
  1225.  
  1226.  
  1227.  
  1228.  
  1229. Cannot Open The File ");
  1230. cout<<"
  1231.  
  1232. PRESS ANY KEY TO Return To Main Menu ";
  1233. getch();
  1234. chdir("\");
  1235. mainwindow();
  1236. }
  1237.  
  1238. fout<<" NAME : "<<name;
  1239.  
  1240. cout<<"
  1241. Fathers Name : ";
  1242. gets(temp);
  1243. fout<<"
  1244. Fathers Name : "<<temp;
  1245.  
  1246. cout<<"
  1247. Date Of Birth : ";
  1248. gets(temp);
  1249. fout<<"
  1250. Date Of Birth : "<<temp;
  1251.  
  1252. cout<<"
  1253. Contact Number : ";
  1254. gets(temp);
  1255. fout<<"
  1256. Contact Number : "<<temp;
  1257.  
  1258. cout<<"
  1259. Address : ";
  1260. gets(temp);
  1261. fout<<"
  1262. ADDRESS :"<<temp;
  1263.  
  1264. cout<<"
  1265. Course Name : ";
  1266. gets(temp);
  1267. fout<<"
  1268. Course Name : "<<temp;
  1269.  
  1270. fout.close();
  1271. encrypt(newfile);
  1272. academic(name);
  1273. }
  1274.  
  1275.  
  1276. // FUNCTION TO ENTER A ACADEMIC DETAILS OF A STUDENT
  1277.  
  1278. void academic(char *name)
  1279. {
  1280. clrscr();
  1281.  
  1282. cout<<"
  1283.  
  1284. Enter The Academic Detials ";
  1285. cout<<"
  1286. ========================== ";
  1287.  
  1288. strcpy(newfile,"a");
  1289. strcat(newfile,name);
  1290. strcat(newfile,".txt");
  1291.  
  1292. ofstream foutt(newfile);
  1293.  
  1294. if(!foutt)
  1295. {
  1296. clrscr();
  1297. perror("
  1298.  
  1299.  
  1300.  
  1301.  
  1302. Cannot Open The File ");
  1303. cout<<"
  1304.  
  1305. PRESS ANY KEY TO Return To Main Menu ";
  1306. getch();
  1307. chdir("\");
  1308. mainwindow();
  1309. }
  1310.  
  1311. foutt<<" NAME : "<<name;
  1312.  
  1313. cout<<"
  1314. Type Of Course (Semster/Annual) : ";
  1315. gets(temp);
  1316. foutt<<"
  1317. Type Of Course (Semester/Annual) : "<<temp;
  1318.  
  1319. cout<<"
  1320. Year Of Admission : ";
  1321. gets(temp);
  1322. foutt<<"
  1323. Year Of Admission : "<<temp;
  1324.  
  1325. cout<<"
  1326. Admission Number : ";
  1327. gets(temp);
  1328. foutt<<"
  1329. Admission Number : "<<temp;
  1330.  
  1331. cout<<"
  1332. Percentage In Intermediate : ";
  1333. gets(temp);
  1334. foutt<<"
  1335. Percentage In Intermediate : "<<temp;
  1336.  
  1337. cout<<"
  1338. Percentage In College :";
  1339. foutt<<"
  1340. Percentage In College : ";
  1341.  
  1342. cout<<"
  1343. First Year : ";
  1344. gets(temp);
  1345. foutt<<"
  1346. First Year :"<<temp;
  1347.  
  1348. cout<<"
  1349. Second Year : ";
  1350. gets(temp);
  1351. foutt<<"
  1352. Second Year :"<<temp;
  1353.  
  1354. cout<<"
  1355. Third Year : ";
  1356. gets(temp);
  1357. foutt<<"
  1358. third Year :"<<temp;
  1359.  
  1360. foutt.close();
  1361. encrypt(newfile);
  1362. }
  1363.  
  1364.  
  1365. // FUNCTION TO SEE A TOTAL STUDENTS OF A PARTICULAR YEAR
  1366.  
  1367. void seetotalst()
  1368. {
  1369. clrscr();
  1370.  
  1371. chdir("data");
  1372. chdir("student");
  1373.  
  1374. cout<<"
  1375.  
  1376. Enter The Year Of Which You Want To See The Students
  1377. ";
  1378. gets(year);
  1379.  
  1380. chdir(year);
  1381.  
  1382. cout<<"
  1383.  
  1384. These Are The Students
  1385.  
  1386. ";
  1387.  
  1388. system("dir /b /ad /w");
  1389.  
  1390. getch();
  1391. chdir("\");
  1392. mainwindow();
  1393. }
  1394.  
  1395.  
  1396. // FUNCTION TO SEE ALL DETAILS OF A STUDENT
  1397.  
  1398. void fullaccessst()
  1399. {
  1400. clrscr();
  1401.  
  1402. chdir("data");
  1403. chdir("student");
  1404.  
  1405. cout<<"
  1406.  
  1407. Enter The Year Of The Student : ";
  1408. gets(year);
  1409.  
  1410. chdir(year);
  1411.  
  1412. cout<<"
  1413.  
  1414. Enter The Name Of The Student : ";
  1415. gets(name);
  1416.  
  1417. chdir(name);
  1418.  
  1419. cout<<"
  1420.  
  1421. What You Want To See Personal Information Or Academic
  1422. Information ";
  1423. cout<<"
  1424. 1. Personal ";
  1425. cout<<"
  1426. 2. Academic ";
  1427. cout<<"
  1428.  
  1429. Option------> ";
  1430.  
  1431. cin>>option;
  1432.  
  1433. clrscr();
  1434.  
  1435. cout<<"
  1436.  
  1437.  
  1438. ";
  1439.  
  1440. if(option==1)
  1441. {
  1442. strcpy(newfile,"p");
  1443. strcat(newfile,name);
  1444. strcat(newfile,".txt");
  1445.  
  1446. ifstream fin(newfile);
  1447.  
  1448. if(!fin)
  1449. {
  1450. clrscr();
  1451. perror("
  1452.  
  1453.  
  1454.  
  1455.  
  1456. Cannot Open The File ");
  1457. cout<<"
  1458.  
  1459. PRESS ANY KEY TO Return To Main Menu ";
  1460. getch();
  1461. chdir("\");
  1462. mainwindow();
  1463. }
  1464.  
  1465. while(fin.get(ch)!=0)
  1466. {
  1467. mod=~ch;
  1468. cout<<mod;
  1469. }
  1470.  
  1471. getch();
  1472. fin.close();
  1473. }
  1474.  
  1475. if(option==2)
  1476. {
  1477. strcpy(newfile,"a");
  1478. strcat(newfile,name);
  1479. strcat(newfile,".txt");
  1480.  
  1481. ifstream fin(newfile);
  1482.  
  1483. if(!fin)
  1484. {
  1485. clrscr();
  1486. perror("
  1487.  
  1488.  
  1489.  
  1490.  
  1491. Cannot Open The File ");
  1492. cout<<"
  1493.  
  1494. PRESS ANY KEY TO Return To Main Menu ";
  1495. getch();
  1496. chdir("\");
  1497. mainwindow();
  1498. }
  1499.  
  1500. while(fin.get(ch)!=0)
  1501. {
  1502. mod=~ch;
  1503. cout<<mod;
  1504. }
  1505.  
  1506. getch();
  1507. fin.close();
  1508. }
  1509.  
  1510. chdir("\");
  1511. mainwindow();
  1512. }
  1513.  
  1514.  
  1515. // FUNCTION TO MODIFY DETAILS OF A STUDENT
  1516.  
  1517. void modifyst()
  1518. {
  1519. chdir("data");
  1520. chdir("student");
  1521.  
  1522. cout<<"
  1523.  
  1524. Enter The Year Of You Want To Change The Information : ";
  1525. gets(year);
  1526.  
  1527. chdir(year);
  1528.  
  1529. cout<<"
  1530.  
  1531. Enter The Name Of A Student : ";
  1532. gets(name);
  1533.  
  1534. status=rmdir(name);
  1535.  
  1536. if(status==0)
  1537. {
  1538. personalst();
  1539. }
  1540.  
  1541. else
  1542. {
  1543. clrscr();
  1544. perror("
  1545.  
  1546.  
  1547.  
  1548.  
  1549. Cannot Open The File ");
  1550. cout<<"
  1551.  
  1552. PRESS ANY KEY TO Return To Main Menu ";
  1553. getch();
  1554. chdir("\");
  1555. mainwindow();
  1556. }
  1557.  
  1558. chdir("\");
  1559. mainwindow();
  1560. }
  1561.  
  1562.  
  1563. // FUNCTION TO DELETE A STUDENT RECORD
  1564.  
  1565. void deletest()
  1566. {
  1567. clrscr();
  1568.  
  1569. chdir("data");
  1570. chdir("student");
  1571.  
  1572. cout<<"
  1573.  
  1574. Enter The Year : ";
  1575. gets(year);
  1576.  
  1577. chdir(year);
  1578.  
  1579. cout<<"
  1580.  
  1581. Enter The Name Of A Student : ";
  1582. gets(name);
  1583.  
  1584. cout<<"
  1585.  
  1586. Are You Sure You Want To Remove It (y/n) : ";
  1587. cin>>ch;
  1588.  
  1589. if(ch=='y')
  1590. {
  1591. status=rmdir(name);
  1592.  
  1593. if(status==0)
  1594. {
  1595. cout<<"
  1596.  
  1597. Record Have Been Removed Succesfully ";
  1598. cout<<"
  1599. Press Any Key To Return To Main Menu ";
  1600. getch();
  1601. chdir("\");
  1602. mainwindow();
  1603. }
  1604.  
  1605. else
  1606. {
  1607. clrscr();
  1608. perror("
  1609.  
  1610.  
  1611.  
  1612.  
  1613. Cannot Open The File ");
  1614. cout<<"
  1615.  
  1616. PRESS ANY KEY TO Return To Main Menu ";
  1617. getch();
  1618. chdir("\");
  1619. mainwindow();
  1620. }
  1621. }
  1622.  
  1623. else
  1624. {
  1625. chdir("\");
  1626. mainwindow();
  1627. }
  1628. }
  1629.  
  1630.  
  1631. // FUNCTION TO CLOSE A PROGRAM
  1632.  
  1633. void closeprog()
  1634. {
  1635. grap();
  1636. setcolor(6);
  1637.  
  1638. for(i=0;i<=220;i++)
  1639. {
  1640. rectangle(0+i,0+i,640-i,480-i);
  1641. delay(15);
  1642. }
  1643.  
  1644. for(i=0;i<=220;i++)
  1645. {
  1646. rectangle(100+i,100,540-i,380);
  1647. delay(10);
  1648. }
  1649.  
  1650. quit();
  1651. closegraph();
  1652. exit(0);
  1653. }
  1654.  
  1655.  
  1656. void quit()
  1657. {
  1658. int a,b,c;
  1659. setcolor(0);
  1660.  
  1661. for(a=1,b=getmaxy()-1,c=200;a<=getmaxy()/2;a++,b--,c--)
  1662. {
  1663. line(1,a,getmaxx()-1,a);
  1664. line(1,b,getmaxx()-1,b);
  1665. sound(10*(c+200));
  1666. delay(1);
  1667. }
  1668.  
  1669. delay(300);
  1670. nosound();
  1671. setcolor(4);
  1672.  
  1673. typeme(xy(2),xy(20),"DEVELOPED BY: VIVEK AND SAURABH JAIN",30);
  1674. delay(1000);
  1675. setcolor(0);
  1676.  
  1677. typeme(xy(2),xy(20)," DEVELOPED BY : SAURABH JAIN ",30);
  1678. delay(100);
  1679. setcolor(4);
  1680.  
  1681. typeme(xy(2),xy(20),"FOR YOUR COMMENTS AND YOUR SUGGESTIONS",30);
  1682. delay(500);
  1683. setcolor(4);
  1684.  
  1685. typeme(xy(2),xy(26),"EMAIL ME AT dropurmails_here@yahoo.com",30);
  1686. delay(2000);
  1687. }
  1688.  
  1689.  
  1690. void typeme(int left,int top,const char *word,int interval)
  1691. {
  1692. char code[2];
  1693. int length=strlen(word);
  1694. for(int i=0;i<=length;i++)
  1695. {
  1696. code[0]=word[i];
  1697. code[1]='
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
Success #stdin #stdout 0.02s 5352KB
stdin
1
2
10
42
11
stdout
Done.
Stack size 0
Heap size 0