Sunteți pe pagina 1din 24

INDEX

S.NO CONTENT PAGE NO


1. HARDWARE AND SOFTWARE USED 5
2. HEADER FILE INCLUDES 6
3. FILE AND CLASSES USED 7
4. SOURCE CODE 8
5. FLOW OF PROGRAM
6. SCREEN SHOTS
7. BIBLIOGRAPHY

4
HARDWARE AND
SOFTWARE
Laptop
1. Intel Core i5-2410M processor(2.9GHz)
2. 6 GB DDR3 Memory
3. Window 10 Professional

Software Used
1. TURBO C++
2. Microsoft Word 2010

5
HEADER FILE
INCLUDES
S.No Header File Name Description
iostream.h
1.
( Input-output header)
Perform console input and console output
conio.h
operations like clrscr() to clear the screen and
2. (Console input-output
getch() to get the character from the
header)
keyboard.
string.h Perform string manipulation operations like
3.
(String header) strlen() and strcpy()

4. fstream.h

stdio.h
5. (Standard input-output Used to perform input and output operations
header)
stdlib.h Perform standard utility functions like
6.
(Standard library header) dynamic memory allocation

6
FILE USED
S.No File Name Description
1. std01.dat To store details related to student.
2. tec01.dat To store details related to teacher.
3. Temp.dat To store different details for some short time.

CLASSES USED
S.No Class Name Description
1. Student Information related to student
2. Teacher Information related to teacher

7
SOURCE CODE
//***************************************************************
// HEADER FILE USED IN THE PROGRAM
//***************************************************************

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>

//***************************************************************
// PROTOTYPE OF GLOBAL FUNCTIONS
//***************************************************************

void step();
void tstep();
void intro();
void modify();
void Display();
int CountRecord();
void Deletion();

//***************************************************************
// DEFINATION OF CLASSES
//***************************************************************

class student
{
int roll;
float pc;
char name[20],pass[20];
float ph,ch,ma;
public:
void take(); //S1
void show(); //S2
void addf(); //S3

8
void seef(); //S4
void seeall(); //S5
void login(); //S6
int seeroll(); //S7
int seepass(char p[]); //S8
};

class teacher
{
char name[20],pass[20];
long roll;
public:
void take(); //T1
void addf(); //T2
void login(); //T3
int seeroll(); //T4
int seepass(char p[]); //T5
};

//***************************************************************
// DEFINATION OF A FUNCTION USED IN CLASS 'STUDENT'
//***************************************************************

void student::take() //S1


{
cout<<"\nEnter Student Roll no :";
cin>>roll;
cout<<"\nEnter Student Name :";
gets(name);
cout<<"\nEnter Student Password :";
gets(pass);
cout<<"\nEnter Physics marks :";
cin>>ph;
cout<<"\nEnter Chemistry marks :";
cin>>ch;
cout<<"\nEnter Mathematics marks :";
cin>>ma;
pc=((ma+ph+ch)/3);
}
void student::show() //S2

9
{
clrscr();
cout<<"\n\n\n\t\t\t\tREPORT CARD";
cout<<"\n\n\nStudent Id : "<<roll;
cout<<"\nStudent Name : "<<name;
cout<<"\nStudent Password : "<<pass;
gotoxy(33,13);
cout<<"Marks Obtained";
gotoxy(23,15);
cout<<"Physics Chemistry Maths Percentage";
gotoxy(22,16);
for(int i=1;i<=36;i++)
{
cout<<"-";
}
gotoxy(25,17);
cout<<ph<<"\t "<<ch<<"\t "<<ma<<"\t "<<pc<<"%";
}
void student::addf() //S3
{
student a;
fstream b;
b.open("std01.dat",ios::binary|ios::app);
a.take();
b.write((char*)&a,sizeof(a));
b.close();
}
void student::seef() //S4
{
student a;
fstream b;
b.open("std01.dat",ios::binary|ios::in);
while(b.read((char*)&a,sizeof(a)))
{
a.show();
}
b.close();
}
void student::seeall() //S5
{

10
student a;
cout<<'\n'<<a.roll<<'\t'<<a.name<<'\t'<<ph<<'\t'<<ch<<'\t'<<"
"<<ma<<'\t'<<" "<<pc;
}
void student::login() //S6
{
student a;
fstream b;
randomize();
int h,r=(random(1000)+1000);
b.open("std01.dat",ios::binary|ios::in);
int droll,s=0;
char apass[20];
cout<<"\nEnter student roll no :";
cin>>droll;
cout<<"\nEnter student password :";
gets(apass);
cout<<"\n\nSecurity pin is "<<r;
cout<<"\nEnter security pin : ";
cin>>h;
if(h==r)
{
while(b.read((char*)&a,sizeof(a)))
{
if(droll==a.seeroll() && a.seepass(apass)==0)
{
s+=1;
a.show();
gotoxy(2,24);
cout<<"Press ENTER to logout";
}
}
if(s==0)
{
cout<<"\nNo record found ";
}
}
if(h!=r)
{ char q;
cout<<"\nSecurity pin is not correct";

11
cout<<"\nIf you want to continue pres Y else any key :";
cin>>q;
if(q=='Y')
{
a.login();
}
if(q!='Y')
{
step();
}
}

b.close();
}
int student::seeroll() //S7
{
return roll;
}
int student::seepass(char p[]) //S8
{
return strcmp(pass,p);
}

//***************************************************************
// DEFINATION OF A FUNCTION USED IN CLASS TEACHER
//***************************************************************

void teacher::take()
{
cout<<"\nEnter Teacher Id :";
cin>>roll;
cout<<"\nEnter Name :";
gets(name);
cout<<"\nEnter password :";
gets(pass);
}
void teacher::addf()
{
teacher a;

12
fstream b;
b.open("tec01.dat",ios::binary|ios::app);
a.take();
b.write((char*)&a,sizeof(a));
b.close();
}
int teacher::seeroll()
{
return roll;
}
int teacher::seepass(char p[])
{
return strcmp(pass,p);
}
void teacher::login()
{
teacher a;
fstream b;
randomize();
b.open("tec01.dat",ios::binary|ios::in);
int droll;
int s=0;
int h,r=(random(1000)+1000);
char apass[20];
cout<<"\nEnter teacher id : ";
cin>>droll;
cout<<"\nExnter password : ";
gets(apass);
cout<<"\n\nSecurity pin is "<<r;
cout<<"\nEnter security pin : ";
cin>>h;
int x[10];
int z;
z=strcmpi(apass,"123HKS");
if(h==r)
{
if(droll==101 && z==0 )
{ clrscr();
cout<<"\n\nNOTE : You have enterd pre defined teacher id and
password";

13
cout<<"\n\nThe process of adding a new teacher start\n";
a.addf();
s=s+1;
cout<<"\nA new teacher is added to the list";
getch();
step();
}
while(b.read((char*)&a,sizeof(a)))
{
if(droll==a.seeroll() && a.seepass(apass)==0)
{
s=s+1;
tstep();
getch();
}
}
if(s==0)
{
cout<<"\nNo teacher found with follwoing details \nPres enter";
getch();
step();
}
b.close();
}
if(h!=r)
{ char q;
cout<<"\nSecurity pin is not correct";
cout<<"\nIf you want to continue pres 'Y' else any key :";
cin>>q;
if(q=='Y')
{
a.login();
}
if(q!='Y')
{
step();
}
}
}

14
//***************************************************************
// DEFINATION OF A GLOBAL FUNCTIONS
//***************************************************************

void modify()
{
fstream F1, F2;
student s1, Snew;
int found=0,Ino;
F1.open("std01.dat", ios::binary | ios::in |ios::app);
if(!F1)
{
cout<<"\n\t Unable to open file because file does not exixt";
getch();
}
F2.open("Temp.Dat", ios::binary | ios::app | ios::in);
// User input Item No. to be deleted
if(F1){
cout<<"\n\tEnter student roll no : ";cin>>Ino; // User input Item No. to
be deleted
while(F1.read((char*) &s1, sizeof(s1))) // Read a record & checks for end
of file
{
if(s1.seeroll()!= Ino)
{
F2.write((char*) &s1, sizeof(s1));
}
else
{
s1.seef();
cout<<"\nPlease Enter The New Details of
student"<<endl;
s1.addf();
F2.write((char*)&s1,sizeof(s1));
cout<<"\n\n\t Record Updated";
found=1;
}
}
F1.close();
F2.close();

15
remove("std01.dat");
rename("Temp.Dat","std01.dat");
if(found==0)
cout<<"\n\t Record Not found";
else
cout<<"\n\t Record Updated";
}

/*int ano,found=0,pos;
fstream fp;
student s1;
cout<<"\n\tTo Modify ";
cout<<"\n\tPlease Enter Roll no of student";
cin>>ano;
fp.open("std01.dat",ios::in|ios::binary|ios::out);
while(fp.read((char*)&s1,sizeof(s1)) && found==0)
{
if(s1.seeroll()==ano)
{
s1.seef();
cout<<"\nPlease Enter The New Details of student"<<endl;
s1.addf();
int pos=-1*sizeof(s1);
fp.seekp(pos,ios::cur);
fp.write((char*)&s1,sizeof(s1));
cout<<"\n\n\t Record Updated";
found=1;
}
}
fp.close();
if(found==0)
cout<<"\n\n Record Not Found ";
getch(); */
}
void Display()
{
fstream F;
student a;
F.open("std01.dat", ios::binary | ios::in);
if(!F)

16
{
cout<<"\n\t Unable to open file";
}
if(F)
{
// Read a record & checks for end of file
cout<<"\n\nRoll no\tName\tPhysics\tChemistry Maths
Percentage\n";
for(int i=1;i<=55;i++)
{
cout<<"-";
}
while(F.read((char*)&a , sizeof(a)))
{
a.seeall();
}
}
F.close();
getch();
}
int CountRecord()
{
fstream F;
student s1;
int count=0;
F.open("std01.dat", ios::binary | ios::in);
if(!F)
{
cout<<"\n\t Unable to open file";
getch();
}
if(F)
{
// Read a record & checks for end of file
while(F.read((char*) &s1, sizeof(s1)))
{
count++;
}
F.close();
return count;

17
}
}
void Deletion()
{
fstream F1, F2;
student s1, Snew;
int Delete=0,Ino;
F1.open("std01.dat", ios::binary | ios::in |ios::app);
if(!F1)
{
cout<<"\n\t Unable to open file because file does not exixt";
getch();
}
F2.open("Temp.Dat", ios::binary | ios::app | ios::in);
// User input Item No. to be deleted
if(F1){
cout<<"\n\tEnter student roll no : ";cin>>Ino;
// User input Item No. to be deleted
while(F1.read((char*) &s1, sizeof(s1)))
// Read a record & checks for end of file
{
if(s1.seeroll()!= Ino)
{
F2.write((char*) &s1, sizeof(s1));
}
else
{
Delete++;
}
}
F1.close();
F2.close();
remove("std01.dat");
rename("Temp.Dat","std01.dat");
if(Delete==0)
cout<<"\n\t Record Not found";
else
cout<<"\n\t Record deleted";
}
}

18
void intro()
{
clrscr();
gotoxy(31,4);
cout<<"DELHI PUBLIC SCHOOL";
gotoxy(30,5);
cout<<"---------------------";
gotoxy(36,7);
cout<<"JABALPUR";
gotoxy(35,8);
cout<<"----------";
gotoxy(32,10);
cout<<"CLASS XII PROJECT";
gotoxy(31,11);
cout<<"-------------------";
gotoxy(18,13);
cout<<"TOPICE :- SCHOOL CUM CLASS MANAGMENT PROGRAM";
gotoxy(17,14);
cout<<"----------------------------------------------";
gotoxy(1,20);
cout<<"SUBMITTED BY : HITESH KUMAR";
cout<<"\n\nSUBMITTED TO : Mr. SANJAY MUKERJEE";
getch();
}
void tstep()
{ clrscr();
gotoxy(34,2);
cout<<"TEACHER MENU";
gotoxy(33,3);
cout<<"------------";
cout<<"\n\n1.Add new student data\n2.Delete student data";
cout<<"\n3.Modify student data\n4.See all student data";
cout<<"\n5.Count number of student\n6.Logout";
int a;
student s;
teacher t;
cout<<"\n\nEnter your choice :";
cin>>a;
if(a==1)
{

19
clrscr();
gotoxy(30,2);
cout<<"Adding a new student";
gotoxy(33,4);
cout<<"Student details\n";
s.addf();
getch();
tstep();
}
if(a==2)
{
Deletion();
getch();
tstep();
}if(a==3)
{
modify();
getch();
tstep();
}if(a==4)
{
Display();
getch();
tstep();
}if(a==5)
{
cout<<"\n\nNo of student is/are "<<CountRecord();
getch();
tstep();
}if(a==6)
{
step();
}else
{
exit(1);
}
}
void step()
{
clrscr();

20
gotoxy(32,4);
cout<<"ABC PUBLIC SCHOOL";
gotoxy(31,5);
cout<<"-------------------";
gotoxy(34,7);
cout<<"Login Portal\n\n\n1.Login as Teacher\n2.Login as
Student\n3.Close";
int a;
student s;
teacher t;
cout<<"\n\nEnter your choice : ";
cin>>a;

if(a==1)
{
clrscr();
gotoxy(25,2);
cout<<"LOGIN PORTAL FOR TEACHERS\n";
t.login();
getch();
step();
}
if(a==2)
{
clrscr();
gotoxy(25,2);
cout<<"LOGIN PORTAL FOR STUDENTS\n";
s.login();
getch();

}
if(a==3)
{
clrscr();
gotoxy(30,3);
cout<<"THANKS FOR YOUR TIME";
gotoxy(27,9);
cout<<"PREPARED BY : HITESH KUMAR";
getch();
exit(1);

21
}
else
{
getch();
clrscr();
step();
}
}

//***************************************************************
// THE VOID MAIN FUNCTION OF PROGRAM
//***************************************************************

void main()
{
clrscr();
intro();
step();
}

22
Flow of program
PROGAM

LOGIN PORTAL

1 2 3

TEACHER STUDENT EXIT THE


LOGIN PORTAL LOGIN PORTAL PROGRAM

ENTER CORRET ROLL NO, ENTER INCORRET ROLL NO,


PASSWORD AND SECRITY KEY PASSWORD AND SECRITY KEY

REPORT CARD SHOWN LOGIN PORTAL

ENTER PER-DEFINED ENTER CORRET ENTER INCORRET


ID AND PASSWORD ROLL NO, PASSWORD ROLL NO, PASSWORD

ADD DETAIL OF TEACHER MENU LOGIN PORTAL


NEW TEACHER

ADD NEW DELETE MODIFY SELL ALL COUNT LOGOUT


STUDENT STUDENT STUDENT STUDENT NUMBER
DETAILS DETAILS DETAILS DETAILS OF STUDENT

23
SCREENSHOTS

24
25
26
27

S-ar putea să vă placă și