Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A Project Report on
Software Project(C++)
AISSCE
2016
Submitted By:
PQR Paul
Roll no: 3625712
Submitted to:
Department of Computer Science
Kendriya Vidyalaya No. 2, Shift-1, Delhi Cantt
CERTIFICATE
CERTIFICATE
Examiner
Date:
February, 2016
DECLARATION
PQR Paul
Class XII A
Roll No:3625712
ACKNOWLEDGEMENTS
PQR Paul
Class XII A
CONTENTS
1.
Introduction
2.
3.
Testing
4.
Bibliography
INTRODUCTION
Schools of KVS are one of the renouned Institutions of
India , students and as well as teacher of it are indulged not only
in academic but also many co-curicular activities. Since it is a
Govt. of India undertaken Institution there fore it has a lot of
paper works to be done , usually they are done by maintaining
huge registers, from the entry of a person in vidyalaya to the lists
of TC issued students, all are manually recorded. It increases a lot
of data redundancy and personal errors done by the staffs.So by
maintaining a digital record the effort is reduced a lot and
secondly a large amount of energy and resourses is saved.
Since a school has a lot of elements that is to be
recorded manually therefore combining all of them in one
programe will be a very tough job. So I have designed my program
in C++ to cover some of its aspects. My programe is associated
with basic database of all teachers and student containing the bio
data of them , it allows to add , delete ,edit biodata of
students.And it also contains a ID no based entry system thats
records the entry of a particular person.
void welcome_screen(void);
int administrator_menu(void);
void search_teacher(void);
void search_student(void);
void show_all_teacher(void);
void show_all_student(void);
void delete_teacher(void);
void delete_student(void);
void edit_teacher(void);
void edit_student(void);
void show_all_entry(void);
void show_part_entry(void);
void add_entry();
void char main_screen(void)
//Welcome function
void welcome_screen()
{
clrscr();
for(int i=2;i<78;i++)
{
gotoxy(i,2);
textcolor(RED+BLINK);
cputs("-");
}
for(i=3;i<24;i++)
{
gotoxy(2,i);
textcolor(RED+BLINK);
cputs("|");
gotoxy(77,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=2;i<78;i++)
{
gotoxy(i,24);
textcolor(RED+BLINK);
cputs("-");
}
for(i=4;i<23;i++)
{
gotoxy(8,i);
textcolor(LIGHTRED+BLINK);
cputs("*");
}
for(i=4;i<23;i++)
{
gotoxy(70,i);
textcolor(LIGHTRED+BLINK);
cputs("*");
}
for(i=4;i<76;i++)
{
gotoxy(i,6);
textcolor(LIGHTBLUE+BLINK);
cputs("=");
}
for(i=4;i<76;i++)
{
gotoxy(i,20);
textcolor(LIGHTBLUE+BLINK);
cputs("=");
}
gotoxy(20,8);
textcolor(YELLOW);
cputs(" +++++++");
gotoxy(32,8);
textcolor(LIGHTRED+BLINK);
cputs(" W E L C O M E ");
gotoxy(48,8);
textcolor(YELLOW);
cputs(" ++++++++");
gotoxy(30,10);
textcolor(WHITE+RED);
cputs("KENDTIYA VIDYALAYA");
gotoxy(25,11);
textcolor(WHITE+RED);
cputs("G.C. C.R.P.F. Khatkhati,ASSAM");
gotoxy(14,14);
textcolor(LIGHTRED);
cputs("Database Management AND Entry Record Keeping
Program");
gotoxy(27,16);
textcolor(WHITE);
{
clrscr();
for(int i=10;i<68;i++)
{
gotoxy(i,5);
textcolor(YELLOW+BLINK);
cputs("-");
}
for(i=6;i<21;i++)
{
gotoxy(10,i);
textcolor(RED+BLINK);
cputs("|");
gotoxy(67,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=10;i<68;i++)
{
gotoxy(i,21);
textcolor(YELLOW+BLINK);
cputs("-");
}
for(i=6;i<21;i++)
{
gotoxy(16,i);
textcolor(LIGHTRED+BLINK);
cputs("+");
}
for(i=16;i<67;i++)
{
gotoxy(i,8);
textcolor(LIGHTBLUE+BLINK);
cputs("=");
}
gotoxy(23,8);
textcolor(YELLOW);
cputs(" +++++++ ");
gotoxy(35,8);
textcolor(LIGHTRED+BLINK);
cputs("
MAIN MENU
");
gotoxy(51,8);
textcolor(YELLOW);
cputs(" ++++++++ ");
gotoxy(30,13);
textcolor(WHITE+RED);
cputs("1. ADMINISTRATOR MENU ");
gotoxy(30,15);
textcolor(WHITE+RED);
cputs("2. Add Entry ");
gotoxy(30,17);
textcolor(WHITE+RED);
cputs("3. Exit ");
char ch;
cin>>ch;
return(ch);
//getch();
}
The Administrator menu and its function
textcolor(LIGHTBLUE+BLINK);
cputs("_");
}
for(i=3;i<25;i++)
{
gotoxy(2,i);
textcolor(YELLOW+BLINK);
cputs("|");
gotoxy(77,i);
textcolor(YELLOW+BLINK);
cputs("|");
}
for(i=2;i<78;i++)
{
gotoxy(i,6);
textcolor(LIGHTBLUE+BLINK);
cputs("_");
}
gotoxy(14,4);
textcolor(RED);
cputs("||
A D M I N S T R A T I V E
||");
gotoxy(23,9);
textcolor(MAGENTA);
cputs("1.
Add New Teacher");
gotoxy(23,10);
textcolor(MAGENTA);
cputs("2.
Add New Student");
gotoxy(23,11);
textcolor(MAGENTA);
cputs("3.
Search Teacher");
gotoxy(23,12);
textcolor(MAGENTA);
cputs("4.
Search Student");
gotoxy(23,13);
textcolor(MAGENTA);
cputs("5.
Show All Teacher");
gotoxy(23,14);
textcolor(MAGENTA);
cputs("6.
Show All Student");
gotoxy(23,15);
textcolor(MAGENTA);
cputs("7.
Delete Teacher");
gotoxy(23,16);
textcolor(MAGENTA);
cputs("8.
Delete Student");
gotoxy(23,17);
textcolor(MAGENTA);
M E N U
cputs("9.
Edit Teacher");
gotoxy(23,18);
textcolor(MAGENTA);
cputs("10.
Edit Student");
gotoxy(23,19);
textcolor(MAGENTA);
cputs("11.
Show All Entry");
gotoxy(23,20);
textcolor(MAGENTA);
cputs("12.
Show Particular Entry");
gotoxy(23,22);
textcolor(LIGHTGREEN);
cputs("ENTER YOUR CHOICE...");
cin>>ch;
return(ch);
}
The adding new teacher window and its function
It takes ID no of new teacher as input and check its availability
cputs("--------------------------------");
gotoxy(10,10);
textcolor(WHITE);
cputs("Quater number
:
|
");
gotoxy(38,11);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,12);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,13);
textcolor(WHITE);
cputs("Basic Pay (Rs)
:
|
");
gotoxy(38,14);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,15);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,16);
textcolor(WHITE);
cputs("Name
:
|
");
gotoxy(38,17);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,18);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,19);
textcolor(WHITE);
cputs("E-main Id
:
|
");
gotoxy(38,20);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,21);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,22);
textcolor(WHITE);
cputs("Post
:
|
");
gotoxy(38,23);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(39,7);
cin>>id_no;
gotoxy(39,10);
cin>>qtr_no;
gotoxy(39,13);
cin>>basic_pay;
gotoxy(39,16);
gets(name);
gotoxy(39,19);
gets(email_id);
gotoxy(39,22);
gets(post);
fout.open("Teacher.dat",ios::binary|ios::app);
fout.write((char *)&t1,sizeof(t1));
fout.close();
clrscr();
for(i=0;i<3;i++)
{
clrscr();
delay(500);
gotoxy(25,11);
cputs("*** Teacher Added Sucessfully ***");
delay(500);
}
return;
}
gotoxy(10,7);
textcolor(WHITE);
cputs("*******************************************************
****");
gotoxy(38,8);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,9);
textcolor(WHITE);
cputs("ID number
:
|
| ");
gotoxy(38,10);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,11);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,12);
textcolor(WHITE);
cputs("Rollno
:
|
| ");
gotoxy(38,13);;
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,14);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,15);
textcolor(WHITE);
cputs("Name
:
|
| ");
gotoxy(38,16);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,17);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,18);
textcolor(WHITE);
cputs("E-mail Id
:
|
| ");
gotoxy(38,19);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,20);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,21);
textcolor(WHITE);
cputs("Class
:
|
| ");
gotoxy(38,22);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(39,9);
cin>>id_no;
int t=id_no;
fin.open("Student.dat",ios::binary|ios::in);
fin.seekg(0);
int p=1;
while(fin.read((char *)&s1,sizeof(s1))&&(p!=0))
{
int x=s1.getid();
if(t==x)
{
clrscr();
cout<<"\n\n\n\t\t Student already Exist !!! ENTER NEW ID
NUMBER ";
delay(1000);
add_stu();
return;
}
}
gotoxy(39,12);
cin>>rollno;
gotoxy(39,15);
gets(name);
gotoxy(39,18);
gets(email_id);
gotoxy(39,21);
gets(clas);
fout.open("Student.dat",ios::binary|ios::app);
fout.write((char *)&s1,sizeof(s1));
fout.close();
clrscr();
for(i=0;i<3;i++)
{
clrscr();
delay(250);
gotoxy(25,11);
cputs("*** Student Added Sucessfully ***");
delay(250);
}
return;
}
}
fin.close();
if(flag==0) cout<<"\n\t\tTeaher does not exist....Please
Retry!";
getch();
}
The Disp_tech() funC
void teacher::disp_tech()
{
clrscr();
for(int i=5;i<74;i++)
{
gotoxy(i,2);
textcolor(YELLOW+BLINK);
cputs("-");
}
for(i=3;i<24;i++)
{
gotoxy(5,i);
textcolor(RED+BLINK);
cputs("|");
gotoxy(73,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=5;i<74;i++)
{
gotoxy(i,24);
textcolor(YELLOW+BLINK);
cputs("-");
}
gotoxy(27,4);
textcolor(LIGHTRED);
cputs("Displaying Teacher Details");
gotoxy(10,5);
textcolor(WHITE);
cputs("*******************************************************
****");
gotoxy(10,6);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,7);
textcolor(WHITE);
cputs("|| ID number
:
||");
gotoxy(10,8);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,9);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,10);
textcolor(WHITE);
cputs("|| Quater number :
||");
gotoxy(10,11);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,12);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,13);
textcolor(WHITE);
cputs("|| Basic Pay (Rs) :
||");
gotoxy(10,14);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,15);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,16);
textcolor(WHITE);
cputs("|| Name
:
||");
gotoxy(10,17);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,18);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,19);
textcolor(WHITE);
:
cputs("|| E-main Id
||");
gotoxy(10,20);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,21);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,22);
textcolor(WHITE);
cputs("|| Post
:
||");
gotoxy(10,23);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(39,7);
cout<<id_no;
gotoxy(39,10);
cout<<qtr_no;
gotoxy(39,13);
cout<<basic_pay;
gotoxy(39,16);
cputs(name);
gotoxy(39,19);
cputs(email_id);
gotoxy(39,22);
cputs(post);
}
The Searching teacher window and its code
First it takes the Id no and then if available then displays it
gotoxy(73,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=5;i<74;i++)
{
gotoxy(i,24);
textcolor(YELLOW+BLINK);
cputs("-");
}
gotoxy(27,5);
textcolor(LIGHTRED);
cputs("Displaying Student Details");
gotoxy(10,7);
textcolor(WHITE);
cputs("*******************************************************
****");
gotoxy(10,8);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,9);
textcolor(WHITE);
cputs("|| ID number
:
||");
gotoxy(10,10);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,11);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,12);
textcolor(WHITE);
cputs("|| Rollno
:
||");
gotoxy(10,13);;
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,14);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,15);
textcolor(WHITE);
cputs("|| Name
:
||");
gotoxy(10,16);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,17);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,18);
textcolor(WHITE);
cputs("|| E-mail Id
:
||");
gotoxy(10,19);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,20);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(10,21);
textcolor(WHITE);
cputs("|| Class
:
||");
gotoxy(10,22);
textcolor(WHITE);
cputs("------------------------------------------------------------");
gotoxy(39,9);
cout<<id_no;
gotoxy(39,12);
cout<<rollno;
gotoxy(39,15);
cputs(name);
gotoxy(39,18);
cputs(email_id);
gotoxy(39,21);
cputs(clas);
}
}
textcolor(WHITE);
{
gotoxy(4,i);cout<<t1.id_no;
gotoxy(13,i);cout<<t1.qtr_no;
gotoxy(21,i);cout<<t1.basic_pay;
gotoxy(32,i);cputs(t1.name);
gotoxy(48,i);cputs(t1.email_id);
gotoxy(73,i);cputs(t1.post);
}
i++;
if(i==23)
{
getch();
clrscr();
textcolor(LIGHTGREEN);
gotoxy(1,2);
cputs("=======================================================
=======================");
gotoxy(1,3);
cputs("|| Id no ||Qtr no||Basic Pay||
Name
||
Email_id
||Post||");
gotoxy(1,4);
cputs("=======================================================
=======================");
i=5;
}
}
fin.close();
getch();
return;
}
The Show all the student window and its code
//funC to show all student
void show_all_student(void)
{
clrscr();
textcolor(LIGHTGREEN);
gotoxy(1,2);
cputs("=======================================================
=======================");
gotoxy(1,3);
cputs("|| Id no ||Rollno||Name
||Email_id
||Class||");
gotoxy(1,4);
cputs("=======================================================
=======================");
fin.open("Student.dat",ios::binary|ios::in);
fin.seekg(0);
int i=5;
while(fin.read((char*)&s1, sizeof(s1))&&i<25)
{
if(fin.eof())
{
getch();
return;
}
textcolor(WHITE);
{
gotoxy(4,i);cout<<s1.id_no;
gotoxy(13,i);cout<<s1.rollno;
gotoxy(21,i);cputs(s1.name);
gotoxy(43,i);cputs(s1.email_id);
gotoxy(71,i);cputs(s1.clas);
}
i++;
if(i==24)
{
getch();
clrscr();
textcolor(LIGHTGREEN);
gotoxy(1,2);
cputs("=======================================================
=======================");
gotoxy(1,3);
cputs("|| Id no ||Rollno||Name
||Email_id
||Class||");
gotoxy(1,4);
cputs("=======================================================
=======================");
i=5;
}
}
fin.close();
getch();
return;
}
else if (flag==0)
cout<<"\n\t\tStudent does not Exist! Please Retry";
getch();
}
The Edit teacher funC and its code
//funC to edit teacher
void edit_teacher(void)
{
clrscr();
flag=0;
cout<<"\n\n\tEnter Teacher ID_no to be edited :";
int eno;
cin>>eno;
fin.open("Teacher.dat",ios::binary);
if(!fin)
{
cout<<"\n\nFile Not Found...";
return;
}
fstream tmp("temp_tech.dat",ios::binary|ios::out);
fin.seekg(0);
while(fin.read((char*)&t1, sizeof(t1)))
{
int x=t1.getid();//t1.teacher::getid();
if(x!=eno)
tmp.write((char*)&t1,sizeof(t1));
else
{
clrscr();
for(int i=5;i<74;i++)
{
gotoxy(i,2);
textcolor(YELLOW+BLINK);
cputs("-");
}
for(i=3;i<24;i++)
{
gotoxy(5,i);
textcolor(RED+BLINK);
cputs("|");
gotoxy(73,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=5;i<74;i++)
{
gotoxy(i,24);
textcolor(YELLOW+BLINK);
cputs("-");
}
gotoxy(27,4);
textcolor(LIGHTRED);
cputs("Editing Teacher Details");
gotoxy(10,5);
textcolor(WHITE);
cputs("*******************************************************
****");
gotoxy(38,6);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,7);
textcolor(WHITE);
|
cputs("ID number
:
| ");
gotoxy(38,8);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,9);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,10);
textcolor(WHITE);
cputs("Quater number
:
|
| ");
gotoxy(38,11);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,12);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,13);
textcolor(WHITE);
cputs("Basic Pay (Rs)
:
|
| ");
gotoxy(38,14);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,15);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,16);
textcolor(WHITE);
cputs("Name
:
|
| ");
gotoxy(38,17);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,18);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,19);
textcolor(WHITE);
cputs("E-main Id
:
|
| ");
gotoxy(38,20);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,21);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,22);
textcolor(WHITE);
cputs("Post
:
|
| ");
gotoxy(38,23);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(39,7);
cin>>t1.id_no;
gotoxy(39,10);
cin>>t1.qtr_no;
gotoxy(39,13);
cin>>t1.basic_pay;
gotoxy(39,16);
gets(t1.name);
gotoxy(39,19);
gets(t1.email_id);
gotoxy(39,22);
gets(t1.post);
tmp.write((char*)&t1,sizeof(t1));
flag=1;
}
}
fin.close();
tmp.close();
fout.open("Teacher.dat",ios::trunc|ios::binary);
fout.seekp(0);
tmp.open("temp_tech.dat",ios::binary|ios::in);
if(!tmp)
{
cout<<"Error in File";
return;
}
while(tmp.read((char*)&t1,sizeof(t1)))
fout.write((char*)&t1,sizeof(t1));
tmp.close();
fout.close();
if(flag==1)
{
cout<<"\n\t\tTeacher Succesfully Edited";
getch();
}
else if(flag==0)
{
cout<<"\n\t\tTeacher does not Exist! Please Retry";
getch();
}
return;
}
The Edit Student funC and its code
//funC to edit student
void edit_student(void)
{
clrscr();
flag=0;
cout<<"\n\n\tEnter Student ID_no to be edited :";
int eno;
cin>>eno;
fin.open("Student.dat",ios::binary);
if(!fin)
{
cout<<"\n\nFile Not Found...";
return;
}
fstream tmp("temp_stud.dat",ios::binary|ios::out);
fin.seekg(0);
while(fin.read((char*)&s1, sizeof(s1)))
{
int x=s1.getid();//t1.teacher::getid();
if(x!=eno)
tmp.write((char*)&s1,sizeof(s1));
else
{
clrscr();
for(int i=5;i<74;i++)
{
gotoxy(i,2);
textcolor(YELLOW+BLINK);
cputs("-");
}
for(i=3;i<24;i++)
{
gotoxy(5,i);
textcolor(RED+BLINK);
cputs("|");
gotoxy(73,i);
textcolor(RED+BLINK);
cputs("|");
}
for(i=5;i<74;i++)
{
gotoxy(i,24);
textcolor(YELLOW+BLINK);
cputs("-");
}
gotoxy(27,5);
textcolor(LIGHTRED);
cputs("Adding Student Details");
gotoxy(10,7);
textcolor(WHITE);
cputs("*******************************************************
****");
gotoxy(38,8);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,9);
textcolor(WHITE);
cputs("ID number
:
|
| ");
gotoxy(38,10);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,11);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,12);
textcolor(WHITE);
cputs("Rollno
:
|
| ");
gotoxy(38,13);;
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,14);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,15);
textcolor(WHITE);
cputs("Name
:
|
| ");
gotoxy(38,16);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,17);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,18);
textcolor(WHITE);
cputs("E-mail Id
:
|
| ");
gotoxy(38,19);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(38,20);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(10,21);
textcolor(WHITE);
cputs("Class
:
|
| ");
gotoxy(38,22);
textcolor(WHITE);
cputs("--------------------------------");
gotoxy(39,9);
cin>>s1.id_no;
gotoxy(39,12);
cin>>s1.rollno;
gotoxy(39,15);
gets(s1.name);
gotoxy(39,18);
gets(s1.email_id);
gotoxy(39,21);
gets(s1.clas);
tmp.write((char*)&s1,sizeof(s1));
flag=1;
}
}
fin.close();
tmp.close();
fout.open("Student.dat",ios::trunc|ios::binary);
fout.seekp(0);
tmp.open("temp_stud.dat",ios::binary|ios::in);
if(!tmp)
{
cout<<"Error in File";
return;
}
while(tmp.read((char*)&s1,sizeof(s1)))
fout.write((char*)&s1,sizeof(s1));
tmp.close();
fout.close();
if(flag==1)
{
cout<<"\n\t\tStudent Succesfully Edited ";
getch();
}
else if(flag==0)
{
cout<<"\n\t\tStudent does not Exist! Please Retry";
getch();
}
getch();
return;
}
The show all entry funC and its code
fin.seekg(0);
int i=4;
while(fin.read((char*)&e1, sizeof(e1))&&i<25)
{
flag=1;
cout<<"Id no : "<<e1.idno<<" ";
e1.show_entry();
i++;
if(i==24)
{
getch();
i=4;
clrscr();
}
}
fin.close();
getch();
return;
}
void entry::show_entry(void)
{
cout<<"Year : "<<year<<" Month : "<<month<<" Day :
"<<day<<" Hour : "<<hr<<" Min : "<<min<<" Sec :
"<<sec<<endl;
}
The show particular entry window and its code
{
cout<<"\n\tEntry doesnot exist !!!";
p=0;
return;
}
}
int i=4;
fin.open("Entry.dat",ios::binary);
if(!fin)
{
cout<<"\n\nFile Not Found...";
return;
}
fin.seekg(0);
while(fin.read((char*)&e1, sizeof(e1))&&i<25)
{
int x=e1.get_id();
if(x==idno&&!fin.eof())
{
flag=1;
e1.show_entry();
i++;
if(i==24)
{
getch();
i=4;
clrscr();
gotoxy(1,2);
}
}
}
fin.close();
if(flag==0)
cout<<"\n\tRechecked !!!!!!!
Entry not found ";
getch();
return;
}
{
fin.open("Teacher.dat",ios::binary|ios::in);
if(!fin)
{
cout<<"\n\nFile Not Found...";
return;
}
fin.seekg(0);
while(fin.read((char*)&t1, sizeof(t1)))
{
int x=t1.teacher::getid();
if(x==idno)
{
flag=1;
cout<<"\n\t Welcome : "<<t1.name;
p=0;
}
}
fin.close();
fin.open("Student.dat",ios::binary);
if(!fin)
{
cout<<"\n\nFile Not Found...";
return;
}
fin.seekg(0);
while(fin.read((char*)&s1, sizeof(s1)))
{
int x=s1.getid();
if(x==idno)
{
cout<<"\n\tWelcome : "<<s1.name;
flag=1;
p=0;
}
}
fin.close();
if(flag==0)
{
cout<<"\n\tUnknown member !!!!!! Warning !!!!! Register
yourself !!!!";
cout<<"\n\n\tEnter 'T/t' if teacher or 'S/s' if student
";
char ch;
cin>>ch;
if(ch=='T'||ch=='t')
{
t1.add_tech();
getch();
}
else if(ch=='S'||ch=='s')
{
s1.add_stu();
getch();
}
p=0;
e1.add_entry();
g=0;
}
}while(p==1);
year=1900 + ltm->tm_year;
month=1 + ltm->tm_mon;
day= ltm->tm_mday;
hr=ltm->tm_hour;
min=ltm->tm_min;
sec=ltm->tm_sec;
fout.open("Entry.dat",ios::binary|ios::app);
fout.write((char *)&e1,sizeof(e1));
fout.close();
cout<<"\n\tEntry Recorded";
getch();
return;
}
void entry::show_entry(void)
{
cout<<"Year : "<<year<<" Month : "<<month<<" Day :
"<<day<<" Hour : "<<hr<<" Min : "<<min<<" Sec :
"<<sec<<endl;
}
The main funCs code
//main function
void main()
{
clrscr();
int y=0;
if(y==0)
{
welcome_screen();
y=1;
}
while(1)
{
char ch;
int ch2;
ch=main_screen();
switch(ch)
{
case'1':ch2=administrator_menu();
//ch2=getch();
switch(ch2)
{
case 1:{
clrscr();
cout<<"\n\n\n\t\tEnter Id no to check its
avaiability : ";
int i;
cin>>i;
int t=i;
fin.open("Teacher.dat",ios::binary|ios::in);
fin.seekg(0);
int p=1;
while(fin.read((char
*)&t1,sizeof(t1))&&(p!=0))
{
int x=t1.getid();
if(t==x)
{
clrscr();
cout<<"\n\n\n\t\t Teacher already Exist !!!"
<<"ENTER NEW ID NUMBER ";
delay(1000);
p=0;
}
}
fin.close();
if(p==1)
{
t1.add_tech();
break;
}
else if(p==0)
break;
}
case 2:{
clrscr();
cout<<"\n\n\n\t\tEnter Id no to check its
avaiability : ";
int i;
cin>>i;
int t=i;
fin.open("Student.dat",ios::binary|ios::in);
fin.seekg(0);
int p=1;
while(fin.read((char
*)&s1,sizeof(s1))&&(p!=0))
{
int x=s1.getid();
if(t==x)
{
clrscr();
cout<<"\n\n\n\t\t Student already Exist !!!"
<<"ENTER NEW ID NUMBER ";
delay(1000);
p=0;
}
}
fin.close();
if(p==1)
{
s1.add_stu();
break;
}
else if(p==0)
break;
}
case 3:search_teacher();
break;
case 4:search_student();
break;
case 5:show_all_teacher();
break;
case 6:show_all_student();
break;
case 7:delete_teacher();
break;
case 8:delete_student();
break;
case 9:edit_teacher();
break;
case 10:edit_student();
break;
case 11:show_all_entry();
break;
case 12:show_part_entry();
break;
default:clrscr();
cout<<"\n\n\t\tEnter correct choice";
continue;
}
break;
case'2': e1.add_entry();
break;
case'3': exit(0);
default:clrscr();
cout<<"\n\n\t\tEnter correct choice";
continue;
}
}
}
Testing
CONCLUSION OF PROJECT
BIBLIOGRAPHY
Internet
Computer science book of
class 12th