A Program in C language to display the Faculty Information
only the source code is given here
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<fstream.h>
#include<dir.h>
#include<stdio.h>
#define xy(z) (8*(z-1))
// GLOBAL Funcions
void grap();
void intro();
void box();
void mainwindow();
void faculty();
void student();
void enterdata();
void personaldetial();
void admindetails(char *name);
void seeyearfaculty();
void fullaccessfaculty();
void modifyfaculty();
void deletefaculty();
void prin();
void enterdatast();
void personalst();
void academic(char *name);
void seetotalst();
void fullaccessst();
void modifyst();
void deletest();
void encrypt(char *name);
void closeprog();
void quit();
void typeme(int left,int top,const char *word,int interval);
// GLOBAL Variables
int option,pass,i,access,x,y,status;
char year[10],ch,name[100],temp[200],newfile[100],a[50],mod;
void *p;
size_t area;
void main()
{
grap();
a:clearviewport();
i=0;
rectangle(getmaxx()/2-140,getmaxy()/2-20,getmaxx()/2+135,getmaxy()/2+4);
outtextxy(getmaxx()/2-127,getmaxy()/2-12,”Enter Accesscode:”);
gotoxy(43,15);
//Password Code
do
{
pass=getch();
if(pass==13) goto b;
a[i]=char(pass);
printf(“*”);
sound(500);delay(100);nosound();
i++;
}while(pass!=13);
b:a[i]=0;
access=stricmp(a,”nopassword”);
if(access==0)
{
Printf(“
Access Granted” ..)
Press Any Key To Continue…….”;
intro();
textcolor(BLACK);
textbackground(YELLOW);
mainwindow();
}
else
{
clearviewport();
printf(“
Unautorised Access “);
Printf(“
Press Any Key To Continue……… “);
getch();
goto a;
}
}
// INTRODUCTION SCREEN
void intro()
{
int a,b,c,d;
setfillstyle(8,1);
for(a=0,b=getmaxx(),c=getmaxx()/2,d=getmaxx()/2;a<getmaxx()/2+3;a+=5,b-=5,
c-=5,d+=5)
{
line(c,xy(8),d,xy(8));line(c,xy(51),d,xy(51));
bar(0,xy(9),a,xy(50));bar(b,xy(9),getmaxx(),xy(50));
sound(10*(a+250));delay(10);
}
nosound();
char pattern[] ={0xfe,0xbc,0xda,0xe4,0xe2,0xc0,0×88,0×00};
setfillpattern(pattern,1);
bar(0,0,640,480);
settextstyle(1,0,5);
setcolor(10);
outtextxy(100,140,”INSTITUTE MANAGEMENT”);
outtextxy(250,200,”SYSTEM”);
getch();
setcolor(0);
for(i=0;i<=320;i++)
{
rectangle(0+i,0,640-i,480);
delay(5);
}
closegraph();
}
// DETECTION OF GRAPHICS
void grap()
{
int gd= DETECT, gm, errorcode;
initgraph(&gd, &gm, “c:\tc\bgi”);
errorcode = graphresult();
if(errorcode != grOk)
{
printf(”Graphics error: %s
“, grapherrormsg(errorcode));
exit(1);
}
}
// FUNCTION TO DRAW A BOX
void box(void)
{
int i,x,y;
gotoxy(11,2);
for(i=1; i<=58; i++)
{
putch(196);
}
gotoxy(11,6);
for(i=1; i<=58; i++)
{
putch(196);
}
gotoxy(68,2);
putch(191);
y=3;
for(i=1; i<=21; i++)
{
gotoxy(68,y);
y++;
putch(179);
}
gotoxy(68,24);
putch(217);
gotoxy(11,24);
for(i=1; i<=57; i++)
{
putch(196);
}
gotoxy(11,24);
putch(192);
y=3;
for(i=1; i<=21; i++)
{
gotoxy(11,y);
y++;
putch(179);
}
gotoxy(11,2);
putch(218);
}
// Main Window Function
void mainwindow()
{
clrscr();
box();
gotoxy(26,4);cout<<”INSTITUTE MANAGEMENT SYSTEM “;
gotoxy(26,5);cout<<”===========================”;
gotoxy(26,8);cout<<”Choose Your Option …….”;
gotoxy(26,10);cout<<”1. Faculty Informaton “;
gotoxy(26,12);cout<<”2. Students Information “;
gotoxy(26,14);cout<<”3. Print Any Information “;
gotoxy(26,16);cout<<”Press 0 To Exit
“;
gotoxy(26,18);cout<<”Option —–> “;
cin>>option;
switch(option)
{
case 1 : faculty();
break;
case 2 : student();
break;
case 3 : prin();
break;
default : closeprog();
break;
};
}
// FUNCTION FOR SHOWING A MAIN WINDOW OF FACULTY INFORMATION
void faculty()
{
clrscr();
box();
gotoxy(26,4);cout<<”INSTITUTE MANAGEMENT SYSTEM “;
gotoxy(26,5);cout<<”===========================”;
gotoxy(26,8);cout<<”Choose You Option……..”;
gotoxy(26,10);cout<<”1. Add A New Record “;
gotoxy(26,12);cout<<”2. See All Faculty’s “;
gotoxy(26,14);cout<<”3. Full Access To Any Faculty Information “;
gotoxy(26,16);cout<<”4. Modify Any Information “;
gotoxy(26,18);cout<<”5. Delete Any Information “;
gotoxy(26,20);cout<<”Press 0 To Exit……. “;
gotoxy(26,22);cout<<”Option——> “;
scanf(option);
switch(option)
{
case 1 : enterdata();
break;
case 2 : seeyearfaculty();
break;
case 3 : fullaccessfaculty();
break;
case 4 : modifyfaculty();
break;
case 5 : deletefaculty();
break;
default : closeprog();
break;
};
}
// FUNCTION TO INSERT A DATA OF FACULTY
void enterdata()
{
clrscr();
printf(“
Enter The Year Which you Want To Add The Data “);
cout<<”
============================================= “;
gets(year);
mkdir(”data”);
chdir(”data”);
mkdir(”faculty”);
chdir(”faculty”);
mkdir(year);
chdir(year);
print(“
Enter The Faculty Name : “);
gets(name);
mkdir(name);
chdir(name);
personaldetial();
chdir(”\”);
mainwindow();
}
// FUNCTION TO ENTER A PERSONAL DETAILS OF A FACULTY
void personaldetial()
{
Printf(“
Enter The Personal Details “);
Printf(“
========================== “);
Printf(“
Enter The The Name Of A Person : “);
gets(name);
mkdir(name);
chdir(name);
strcpy(newfile,”p”);
strcat(newfile,name);
strcat(newfile,”.txt”);
ofstream fout(newfile);
if(!fout)
{
clrscr();
perror(”
Cannot Open The File “);
Printf(“
PRESS ANY KEY TO Return To Main Menu “);
getch();
chdir(”\”);
mainwindow();
}
Printf(“name”)
Printf(“Enter The Address : “);
gets(temp);
printf(“ADDRESS :”<<temp);
printf(“
Enter Contact No. : “);
gets(temp);
printf(“
CONTACT No. :”<<temp);
fout.close();
encrypt(newfile);
admindetails(name);
}
// FUNCTION TO ENTER A ADMINISTRATION DETAILS OF A FACULTY
void admindetails(char *name)
{
clrscr();
printf(“
Enter The Administration Detials “);
Printf(“
================================ “);
strcpy(newfile,”a”);
strcat(newfile,name);
strcat(newfile,”.txt”);
ofstream foutt(newfile);
if(!foutt)
{
clrscr();
perror(”
Cannot Open The File “);
Printf(“
PRESS ANY KEY TO Return To Main Menu “);
getch();
chdir(”\”);
mainwindow();
}
Printf(“name”);
Printf(“
Enter Educational Qualification :”);
gets(temp);
printf(“
EDUCATIONAL QUALIFICATIONS :”);
Printf(“
Enter The Name Of The Subjects Taught “);
cout<<”
===================================== “;
Printf(“
SUBJECTS TAUGHT :”);
Printf(“
Subject(s) Taught to First Year: “);
gets(temp);
printf(“
First Year :”);
Printf(“
Type Of Subject (Theory / Practical) :”);
gets(temp);
printf(“
Type of Subject :”);
Printf(“
Subject(s) Taught to Second Year: “);
gets(temp);
printf(“
Second Year :”);
Printf(“
Type Of Subject (Theory / Practical) :”);
gets(temp);
printf(“
Type of Subject :”);
Printf(“
Subject(s) Taught to Third Year: “);
gets(temp);
printf(“
Third Year :”)
Printf(“
Type Of Subject (Theory / Practical) :”);
gets(temp);
printf(“
Type of Subject :”)
Printf(“
Enter Type of Faculty (Permanent / Visiting)”);
gets(temp);
printf(‘
TYPE OF FACULTY :”)
foutt.close();
encrypt(newfile);
}
// FUNCTION TO ENCRYPT A DATA
void encrypt(char *newfile)
{
ofstream fout(”temp.txt”);
ifstream fin(newfile);
while(fin)
{
fin.get(ch);
if(ch==EOF)break;
mod=~ch;
fout<<mod;
}
remove(newfile);
rename(”temp.txt”,newfile);
}
