Sei sulla pagina 1di 25

Summer Fields School

Student Data Management


System

“A project that can be utilized for effective


management of data for all students by various
educational institutions”

Name: Sushank Mishra


Class: XII-B
Roll Number: ______
INDEX

1. Certificate
2. Acknowledgement
3. Hierarchical Diagram of the Project Structure
4. Data required as input
5. Classes and their functions
6. Project Code
7. Output Screens
8. Bibliography
CERTIFICATE
This is to certify that Sushank Mishra, student of class
XII-B, Summer Fields School has successfully completed
the project “Student Data Management System” under
the guidance of Mr. Gurjeet Singh during the academic
session 2019-20 in the partial fulfillment of C++
Practical Examination conducted by CBSE, New Delhi.

Teacher’s Signature External Examiner’s Signature


ACKNOWLEDGEMENT
I would like to express my deep sense of gratitude to my teacher Mr. Gurjeet
Singh for his able and constructive guidance under which I successfully
managed to complete the project. His suggestions and constant motivation are
the real inspiration behind the robustness of the project.

I would also like to thank my parents and friends who have also helped me
through their valuable inputs.

It is the culmination of the efforts made by me and these people that has
helped the project to emerge the way it has!!

Sushank Mishra
XII-B
HIERARCHICAL DIAGRAM OF PROJECT
STRUCTURE

Main
Menu

Add Delete Modify Search Display


Record Record Record Menu Menu

Search by Search By Search by Report of Report


Class Name Adm No. a student for a class
DATA REQUIRED AS INPUT
• Admno - To store student adm no
• Name - name of student
• Father Name - father Name of student
• Class & section - class and section of student
• Session - session
• Marks obtained in 5 subject
• Total Mark - Total marks
• Percentage - percentage marks of student
• Grade - Grade of student

Criteria for Grade calculation

Percentage mark Grade


>=95 A+
<95 and >=90 A
<90 and >=80 B+
<80 and >=70 B
<70 and >=60 C+
<60 C
CLASSES AND THEIR FUNCTIONS
class report {

private :
int admno;
char name[30];
char fname[30];
int std;
char section;
int phy;
int chem;
int math;
int comp;
int eng;
int total;
float per;
char grade[3];

public:
void main_menu(); //function to display main menu

void add_record (); // function to add student record in a data file

void del_record (); // function to delete a record from the data file

void modify_record(); //function to modify original student record

void search_menu(); // function to display search menu


void search_name(); //function to search student name
void search_admno(); //function to search student admno
void search_class(); //function to search student admno

void display_menu(); // function to display display menu


void report_single();// function to show single student report card
void report_class(); // function to show report of students of the given class
PROJECT CODE

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

//class definition

class report {

private :
int admno,std,phy,chem,math,comp,eng;
char name[30],fname[30],section,grade[3];
float per,total;

public :

void read_data() // function to read new student data


{
clrscr();
cout<<"\n Enter Adm No :";
cin>>admno;
cout<<"\n Enter Name : ";
cin>>name;
cout<<"\n Enter Father Name : ";
cin>>fname;
cout<<"\n Enter class : ";
cin>>std;
cout<<"\n Enter Section :";
cin>>section;
cout<<"\n Enter marks obtained in Physics : ";
cin>>phy;
cout<<"\n Enter marks obtained in Chemistry : ";
cin>>chem;
cout<<"\n Enter marks obtained in Maths : ";
cin>>math;
cout<<"\n Enter marks obtained in Computer : ";
cin>>comp;
cout<<"\n Enter marks obtained in English : ";
cin>>eng;

}
void calculate() //function to obtain final percentage and grade for student
{
total = phy+chem+math+comp+eng;
per = floor(total/5.0);

if(per>=95)
strcpy(grade,"A+");

if(per<95 && per>=90)


strcpy(grade,"A");

if(per<90 && per>=80)


strcpy(grade,"B+");

if(per<80 && per>=70)


strcpy(grade,"B");

if(per<70 && per>=60)


strcpy(grade,"C+");
if(per<60)
strcpy(grade,"C");

void disp_data() //function to display complete data of student


{

cout<<"\n Admno : "<<admno;


cout<<"\n Student Name : "<<name;
cout<<"\n Father Name : "<<fname;
cout<<"\n Class & Section : "<<std<<"-"<<section;
cout<<"\n Physics : "<<phy;
cout<<"\n Chemistry : "<<chem;
cout<<"\n Maths : "<<math;
cout<<"\n Computer : "<<comp;
cout<<"\n English : "<<eng;
cout<<"\n Total Marks : "<<total;
cout<<"\n Percentage : "<<per;
cout<<"\n Grade : "<<grade;

}
/*-------Accessor functions to obtain specific student data for manipulation-------*/
int getadmno() //accesses admission no of student
{
return admno;
}
char getsection() //accesses section of the student
{
return section;
}
int getstd() //accesses standard of the student
{
return std;
}
int checkname(char m[30]) //verifies the name of the student
{
if(strcmpi(m,name)==0)
return 0;
else
return 1;
}

void single_report_card() //function to create report card of a student


{
clrscr();

cout<<"\n\t\t Summer Fields School , Kailash Colony";


cout<<"\n\t\t Session : 2019-20";
cout<<"\n-------------------------------------------------------------------------------";
cout<<"\n\n Admno :"<<admno;
cout<<"\n\n Name :"<<name <<"\t\t Father Name :"<<fname<<"\t\t class :"<<std<<"-"<<section;
cout<<"\n\n-------------------------------------------------------------------------------";
cout<<"\n Subject\tMax Mark\tMin Mark\t Marks Obtained";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n Physics\t100\t\t33\t\t\t"<<phy;
cout<<"\n\n Chemistry\t100\t\t33\t\t\t"<<chem;
cout<<"\n\n Maths\t\t100\t\t33\t\t\t"<<math;
cout<<"\n\n Computer\t100\t\t33\t\t\t"<<comp;
cout<<"\n\n English\t100\t\t33\t\t\t"<<eng;
cout<<"\n\n-------------------------------------------------------------------------------";
cout<<"\n Total Marks :\t\t"<<total<<"\t\tPercentage : "<<per<<"\tGrade :"<<grade;
cout<<"\n---------------------------------------------------------------------------------";
}

}s1;
void main_menu(); //function to display main menu

void add_record (); // function to add student record in a data file


void del_record (); // function to delete a record from the data file
void modify_record();

void search_menu(); // function to display search menu


void search_name(); //function to read student name and search the Information in the
given data file
void search_admno(); //function to read student admno and search the Information in
the given data file
void search_class(); //function to read student admno and search the Information in the
given data file
void display_menu(); // function to display display menu
void report_single();// function to show single student report card
void report_class(); // function to show report card of students belonging to given class

/* function to show main menu ------------*/


void main_menu()
{
int choice;
do
{
clrscr();
cout<<"\n\t=====================================================";
cout<<"\n\n\n\t\t R e p o r t C a r d M e n u\n\n";
cout<<"\n\t=====================================================";
cout<<"\n\n\t\t1. Add New Student ";
cout<<"\n\n\t\t2. Delete Student";
cout<<"\n\n\t\t3. Modify student";
cout<<"\n\n\t\t4. Search Menu";
cout<<"\n\n\t\t5. Display Menu ";
cout<<"\n\n\t\t6. Exit ";
cout<<"\n\n\t\t Enter your choice (1..6) : ";
cin>>choice;
switch(choice)
{
case 1: add_record();
getch();
break;
case 2: del_record();
getch();
break;
case 3: modify_record();
getch();
break;
case 4: search_menu();
break;
case 5: display_menu();
break;
case 6: break;
default :
cout<<"\n Wrong Choice.... Try again";
}
}while(choice!=6);
}

/*----------- function to create display menu -----------*/

void display_menu()
{
int choice;
do
{
clrscr();
cout<<"\n\t===================================================";
cout<<"\n\n\n\t\t D i s p l a y M e n u\n\n";
cout<<"\n\t===================================================";
cout<<"\n\n\t\t1. Single Student";
cout<<"\n\n\t\t2. Single class";
cout<<"\n\n\t\t3. Exit ";
cout<<"\n\n\t\t Enter your choice (1..3) : ";
cin>>choice;
switch(choice)
{
case 1: report_single();
break;
case 2: report_class();
break;

case 3: break;
default :
cout<<"\n Wrong Choice.... Try again";
}
}while(choice!=3);

/*------------function to create search menu---------------*/

void search_menu()
{
int choice;
do
{
clrscr();
cout<<"\n\t================================================";
cout<<"\n\n\n\t\t S e a r c h M e n u \n\n";
cout<<"\n\t================================================";
cout<<"\n\n\t\t1. Admno Student";
cout<<"\n\n\t\t2. Student Name";
cout<<"\n\n\t\t3. Class wise";
cout<<"\n\n\t\t4. Exit ";
cout<<"\n\n\n\n\t\t Enter your choice (1..4) : ";
cin>>choice;
switch(choice)
{

case 1: search_admno( );
getch();
break;

case 2: search_name();
getch();
break;

case 3: search_class();
getch();
break;

case 4: break;

default :
cout<<"\n Wrong Choice.... Try again";
}
}while(choice!=4);

/*-------------function to add record in data file ------*/


void add_record ()
{
fstream f;
f.open("report.dat",ios::binary|ios::app);
s1.read_data();
s1.calculate();
f.write((char*)&s1, sizeof(s1));
f.close();
cout<<"\nRecord Added Successfully";
}

/*--------------function to search student record name wise ------*/

void search_name( )
{
ifstream fin;
fin.open("report.dat",ios::binary);
char tname[30];
int flag=0;
clrscr();
cout<<"\n Enter Name to search :";
cin>>tname;

while(fin.read((char*)&s1,sizeof(s1)))
{
if(s1.checkname(tname)==0)
{
clrscr();
cout<<"\n Student Information ";
cout<<"\n--------------------------------------------------------"<<endl;
s1.disp_data();
flag=1;
}
}
fin.close();
if(flag==0)
cout<<"\n No such name : "<<strupr(tname)<<" exist in our record... Try again";
}

/*----------function to call search class wise -------------------------------*/


void search_class()
{
ifstream fin;
fin.open("report.dat",ios::binary);
char tsect;
int tstd;
int flag;

clrscr();
cout<<"\n Enter student Class to search :";
cin>>tstd;
cout<<"\n Enter student section to search :";
cin>>tsect;

clrscr();
cout<<"\n Class :"<<tstd<<" - "<<tsect<<endl;

while(fin.read((char*)&s1,sizeof(s1)))
{
if(tsect==s1.getsection() && tstd == s1.getstd())
{

s1.disp_data();
flag=1;
getch();
}
}
cout<<"\n-------------------------------------------------------------------------------"<<endl;

fin.close();
if(flag==0)
cout<<"\n\n information Not available for class :"<<tstd <<" - "<<tsect;

/*------------function to search record according to student admno ------------*/

void search_admno( )
{
ifstream fin;
fin.open("report.dat",ios::binary);

int tadmno;
int flag=0;

clrscr();
cout<<"\n Enter Admission Number to search : ";
cin>>tadmno;

while(fin.read((char*)&s1,sizeof(s1)))
{
if(tadmno == s1.getadmno())
{
clrscr();
cout<<"\n Student Information ";
cout<<"\n--------------------------------------------------------"<<endl;
s1.disp_data();
flag = 1;
}

}
fin.close();

if(flag==0)
cout<<"\n\n Admission No : "<<tadmno <<" does not exist.... Try again";

/*----------function to show single student report-----*/

void report_single()
{
int tadmno;
int flag =0;
ifstream fin;
fin.open("report.dat",ios::binary); //binary mode

clrscr();
cout<<"\n Enter admission No : ";
cin>>tadmno;

while(fin.read((char*)&s1, sizeof(s1)))
{
if(tadmno ==s1.getadmno())
s1.single_report_card(); // function to display single report card
else
flag =1;
}
fin.close();
if(flag==1)
cout<<"\n\n Admission No :"<<tadmno <<" does not exist.... Try again";
getch();
}

/*-------------function to display class wise report card------------*/


void report_class()
{

int tstd;
char tsect;

ifstream fin;
fin.open("report.dat",ios::binary);

clrscr();

cout<<"n\n Enter Class (1..12) :";


cin>>tstd;
cout<<"\n Enter section :";
cin>>tsect;

clrscr();

while(fin.read((char*)&s1, sizeof(s1)))
{
if( s1.getsection()==tsect && s1.getstd() == tstd)
{
s1.single_report_card();
getch();
cout<<endl;
}
}
getch();
}

/*------------function to delete single record ------*/

void del_record ()
{

fstream f1;
fstream f2;
int tadmno;
int flag =0;
clrscr();
cout<<"\n Enter admno to delete :";
cin>>tadmno;

f1.open("report.dat",ios::binary|ios::in);
f2.open("temp.dat",ios::binary|ios::app);
while(f1.read((char*)&s1, sizeof(s1)))
{
if(tadmno!=s1.getadmno())
f2.write((char*)&s1,sizeof(s1));
else
flag=1;

}
f1.close();
f2.close();

remove("report.dat");
rename("temp.dat","report.dat");

if(flag==1)
cout<<"\n\n Record Sucessfully removed ";
else
cout<<"\n Admission No :"<<tadmno <<" does not exist...Try again";
getch();
}

/*---------function to modify student information-----------------------*/

void modify_record( )
{
ifstream fin;
ofstream fout;
int tadmno;
int flag =0;
clrscr();
cout<<"\n Enter Admno to Modify :";
cin>>tadmno;

fin.open("report.dat",ios::binary);
fout.open("temp.dat",ios::binary);

while(fin.read((char*)&s1, sizeof(s1)))
{
if(tadmno == s1.getadmno())
{ s1.read_data(); s1.calculate(); flag=1; }

fout.write((char*)&s1,sizeof(s1));

}
fin.close();
fout.close();

remove("report.dat");
rename("temp.dat","report.dat");

if(flag==1)
cout<<"\n\n Record Sucessfully modified ";
else
cout<<"\n Admission No :"<<tadmno <<" does not exist...Try again";
getch();

/*-----------main function to implement report class ------------*/


void main() //Declaring the main function
{
clrscr();
main_menu();
getch();
}
OUTPUT CODE
Main Menu

Adding a New Record


Deleting a Record

Modifying a Record

1.Original Record 2.Modified Record


Search Menu

Search by Admission No.


Search By Name

Search By Class
Display Menu

Report of a Single Student


Report of A Class of Students
BIBLIOGRAPHY
1. www.google.com
2. Computer Science with C++ with Sumita Arora
3. www.geeksforgeeks.org
4. www.cplusplus.com

Potrebbero piacerti anche