31
PROBLEM DEFINITION : This project is aimed to ease the management of report cards of the students by a school management. The project is executed in C++. The specifications: Data Entry :- Create Student Record Display Student Record Search Student Record Modify Student Record Delete Student Record Result Report:- Class Wise Result Student Report Card Applying the various concepts taught in the language the project is supposed to work entirely on binary files. Every student’s record has been designed to work entirely on binary files. Every student’s record which needs modifications

Project

Embed Size (px)

Citation preview

Page 1: Project

PROBLEM DEFINITION :

This project is aimed to ease the management of report cards of the students by a school management. The project is executed in C++. The specifications:

Data Entry :-

Create Student Record Display Student Record Search Student Record Modify Student Record Delete Student Record

Result Report:-

Class Wise Result Student Report Card

Applying the various concepts taught in the language the project is supposed to work entirely on binary files. Every student’s record has been designed to work entirely on binary files. Every student’s record which needs modifications can be accessed in the program and modified. The modifications will get stored directly in the binary file.

Page 2: Project

On the event of deleting a record the task can be completed by using the functions provided in the program. Needless to say these changes will also get stored directly in the binary file. This program also displays the class topper and also the details of any other student if required.

PROBLEM ANALYSIS :

Process Steps in Detail

Create Student Record

Accept the details from the user by giving class no followed by roll no, student name and marks of all subjects.

Accept Class No:

Roll No Student Name English Lang Math Science Social

Reports Required

Report should be based on user requirement either class wise all the students record to be displayed

Page 3: Project

or particular student detail to be displayed. Class Result – All Student Record (Based on class (I to X)

Roll No

Student Name

English Lang Math Science Social Total Percentage Grade

Student Report Card (Based on class & Roll N0)

Roll No

Student Name

English Lang Math Science Social Total Percentage Grade

HARDWARE AND SOFTWARE :

Turbo C++ PC/Laptop Requisite memory

CLASS DEFINITION :

class stud

{

char class_no[5];

int studentno;

char studentname[20];

int marks_eng;

int marks_lang;

Page 4: Project

int marks_maths;

int marks_science;

int marks_social;

int total;

int percentage;

char grade[2];

}

FUNCTIONS USED :

calculate():

This function is used to assign the total, percentage and grade. The grade is given accordingly:

If the marks secured are:

Greater than 90 then grade A. Between 80 and 90 then grade B. Between 70 and 80 then grade C. Less than 60 then grade E.

getdata():

This function is used to accept the details of the student.

putdata():

Page 5: Project

This function is used to display the details of the student.

retclass():

This function is used to return the class number.

retnum():

This function is used to return the roll number.

new_student():

This function is used to create a new student record.

search_student_class():

This function is used to read the details of the student by class.

search_student_number():

This function is used to read the details of the student by class.

student_modify():

Page 6: Project

This is a function used to modify the student’s record.

delete sturec():

This is a function used to delete a student’s record.

intro():

This function displays the menu function. This function also has a password security function also has a password safety setting to ensure that no trespasser can misuse the computer to alter the records of the students.

result_menu():

This function displays the records menu when invoked.

BIBLIOGRAPHY:

C++ by Sunita Aroragoogle.comWikipedia.orgask.com

Page 7: Project

FUTURE ENHANCEMENTS:

The program in the future can become a storage system even after the end of the academic year. This program can also go on to incorporate faculty data. This program can also be used to make a complete and comprehensive analysis of each student noting the improvements and noting the percentiles of the students which will benefit them greatly.

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

Page 8: Project

#include<string.h>

#include<fstream.h>

#include<ctype.h>

#include<process.h>

#define PASS "****"

////////////////CLASS DEFINITION/////////////////////////////////////

class stud

{ char class_no[5];

int studentno;

char studentname[20];

int marks_eng;

int marks_lang;

int marks_maths;

int marks_science;

int marks_social;

int total;

int percentage;

char grade[2];

Page 9: Project

public:

///////// FUNCTION TO ASSIGN TOTAL, PERCENTAGE AND GRADE///////////

void calculate()

{total=marks_eng+marks_lang+marks_maths+marks_science+marks_social;

percentage=total/5;

if(percentage>=91)

strcpy(grade,"A");

else if(percentage>=81&&percentage<=90)

strcpy(grade,"B");

else if(percentage>=71&&percentage<=80)

strcpy(grade,"C");

else if(percentage>=61&&percentage<=70)

strcpy(grade,"D");

else

strcpy(grade,"E");

Page 10: Project

}

///////////////FUNCTION TO ACCEPT STUDENT DETAILS//////////////////

void getdata()

{cout<<"\nEnter class number(1-10) : ";

gets(class_no);

cout<<"\nEnter student roll number : ";

cin>>studentno;

cout<<"\nEnter student name : ";

gets(studentname);

cout<<"\nEnter marks in english : ";

cin>>marks_eng;

cout<<"\nEnter marks in language : ";

cin>>marks_lang;

cout<<"\nEnter marks in maths : ";

cin>>marks_maths;

cout<<"\nEnter marks in science : ";

cin>>marks_science;

cout<<"\nEnter marks in social : ";

Page 11: Project

cin>>marks_social;

calculate();

}

//////////////FUNCTION TO DISPLAY STUDENT DETAILS/////////////////////

void putdata()

{cout<<"\n--------------------------------------------------------------------------------";

cout<<"\n||ROLL NO||STUDENT NAME||ENG||LANG||MATHS||SCIENCE||SOCIAL||TOTAL||%AGE||GRADE||";

cout<<"\n--------------------------------------------------------------------------------";

cout<<"\n "<<studentno<<"\t "<<studentname<<"\t "<<marks_eng<<" "<<marks_lang<<" "<<marks_maths<<" "<<marks_science<<" "<<marks_social<<" "<<total<<" "<<percentage<<" "<<grade<<endl<<endl;

}

Page 12: Project

/////////////FUNCTION TO RETURN CLASS NUMBER/////////////////////////

char* retclass()

{return class_no;

}

/////////////FUNCTION TO RETURN ROLL NUMBER/////////////////////////

int retnum()

{return studentno;

}

};

/////////////////END OF CLASS DEFINITION//////////////////////////////////

///////////////FUNCTION TO CREATE NEW STUDENT RECORD//////////////////////

void new_student()

{ clrscr();

stud st;

Page 13: Project

ofstream fout;

fout.open("student.dat",ios::binary|ios::app);

if(!fout)

cout<<"I/O Error\n";

else

{st.getdata();

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

cout<<"\n\tStudent Record Created\n";

getch();}

fout.close();

clrscr();

}

//////////FUNCTION TO READ STUDENT DETAILS BY CLASS///////////////////////////

void search_student_class()

{ int flag=0;

clrscr();

stud st;char class_compare[5];

ifstream fin;

Page 14: Project

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

if(!fin)

cout<<"\nI/O error";

else

{cout<<"\nEnter class from which student records to be read(1-10) ";gets(class_compare);

cout<<"\nRecords of student of class "<<class_compare;

while(!fin.eof())

{

fin.read((char*) &st,sizeof(st));

if(!strcmp(st.retclass(),class_compare))

{

flag=1;

st.putdata();

} }

}

if(!flag)

cout<<"\n\nNo Records Found\n\n";

Page 15: Project

fin.close();

}

///////////////FUNCTION TO READ STUDENT RECORD BY ROLL NO.///////////////////

void search_student_number()

{ clrscr();

int flag=0;

stud st; int num_compare;char class_compare[5];

ifstream fin;

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

if(!fin)

cout<<"\n\nI/O Error";

else

{cout<<"\n\nEnter student class number(1-10) ";

gets(class_compare);

cout<<"\nEnter student roll number ";

cin>>num_compare;

cout<<"\nStudent Record\n";

Page 16: Project

while(!fin.eof())

{

fin.read((char*) &st,sizeof(st));

if((!strcmp(st.retclass(),class_compare))&&(st.retnum()==num_compare))

{flag=1;

st.putdata();

}}

}

if(!flag)

cout<<"\n\nNo Records Found\n\n";

fin.close();

}

/////////////////FUNCTION TO MODIFY STUDENT RECORD///////////////////////////

void student_modify()

{ clrscr();

char class_no[5];

int roll_no,flag=0;

Page 17: Project

stud st;

fstream f;

f.open("student.dat",ios::binary|ios::in|ios::out);

if(!f)

cout<<"\n\nFile could not be open !! Press any Key...";

else

{cout<<"\n\nEnter Class Number of Student Record to be Modified\n";

gets(class_no);

cout<<"\nEnter Roll Number Of Student To Be Modified\n\n";

cin>>roll_no;

while(!f.eof())

{f.read((char*)& st,sizeof(st));

if(!(strcmp(st.retclass(),class_no))&&st.retnum()==roll_no)

{flag=1;

st.putdata();

Page 18: Project

cout<<"\n\nEnter New Details Of Student\n\n";

st.getdata();

f.seekp(f.tellg()-(sizeof(st)),ios::beg);

f.write((char*)&st,sizeof(st));

break;

}

}

}

if(!flag)

{cout<<"\n\n\t Record Not Found\n\n\t";

getch();}

else

{cout<<"\n\n\t Student Record Modified\n";

getch();}

f.close();

clrscr();

}

Page 19: Project

////////////FUNCTION TO DELETE STUDENT RECORD////////////////////////////

void delete_sturec()

{ clrscr();

stud st;

int roll_no;char class_no[5];

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

ofstream fout("temp.dat",ios::binary);

if(!fin||!fout)

cout<<"\nError!!\n";

else

{ cout<<"\nEnter Class Number Of Student ";

gets(class_no);

cout<<"\nEnter Roll Number Of Student to be Deleted ";

cin>>roll_no;

while(!fin.eof())

{ fin.read((char*)&st,sizeof(st));

Page 20: Project

if((strcmp(st.retclass(),class_no))||st.retnum()!=roll_no)

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

}

}

cout<<"\n\n\t Student Record Deleted(if existing) \n";

getch();

fout.close();

fin.close();

remove("student.dat");

rename("temp.dat","student.dat");

clrscr();

}

//////////////////////INTRODUCTION MENU FUNCTION//////////////////////////

void intro()

{ int flag=0;

char password[10];

Page 21: Project

cout<<"\n\n\t\t\tSTUDENT REPORT CARD\n\n\t\t\t PROJECT\n\n\t\t\t\tBY\n\n\t\t\t KUSHAAL NAIR\n\n ";

while(!flag)

{cout<<"\n\n\t\t Enter Admin Password: ";

gets(password);

if(strcmp(password,PASS))

cout<<"\n\n\tWrong Password!!! Try Again Or Ask Admin Assistance\n\n";

else

flag=1;

}

cin.get();

}

//////////////////////////////RESULTS MENU///////////////////////////////

void result_menu()

{ clrscr();

int ch;

Page 22: Project

cout<<"\t 1.CLASS WISE REPORT CARD\n\n\t 2.STUDENT WISE REPORT CARD\n\n\t 3.EXIT\n\n\t Choice: ";

cin>>ch;

switch(ch)

{case 1:search_student_class();

break;

case 2:search_student_number();

break;

case 3:cout<<"\n\n\t\t THANK YOU AND HAVE A NICE DAY ";

getch();

break;

default:cout<<"\n\t INVALID CHOICE ";

break;

}

}

/////////////////////////STUDENT RECORDS MENU////////////////////////////

void sturec_menu()

Page 23: Project

{ clrscr();

int ch;

cout<<"\t 1.CREATE STUDENT RECORD\n\n\t 2.MODIFY STUDENT RECORD\n\n\t 3.DELETE STUDENT RECORD\n\n\t 4.EXIT\n\n\t Choice: ";

cin>>ch;

switch(ch)

{case 1:new_student();

break;

case 2:student_modify();

break;

case 3:delete_sturec();

break;

case 4:cout<<"\n\n\t\t THANK YOU AND HAVE A NICE DAY ";

getch();

break;

default:cout<<"\n\t INVALID CHOICE";

getch();

break;

Page 24: Project

}

}

///////////////////////////MAIN MENU////////////////////////////////////

void main()

{ clrscr();

char rep='y';

int ch;

intro();

clrscr();

while(rep=='y')

{ cout<<"\n\n\t\t\tXYZ SCHOOL STUDENT RECORD MAINFRAME\n\n";

cout<<"\t 1.RESULTS MENU\n\n\t 2.STUDENT RECORDS\n\n\t 3.EXIT\n\n\t Choice: ";

cin>>ch;

switch(ch)

{case 1: result_menu();

break;

Page 25: Project

case 2:sturec_menu();

break;

case 3:

cout<<"\n\n\t\t THANK YOU AND HAVE A NICE DAY ";

getch();

exit(0);

default: cout<<"\n\t INVALID CHOICE \n";

getch();

break;

}

cout<<"\n\tContinue??? [y / n] Choice: ";

cin>>rep;

clrscr();

}

getch();

}

Page 26: Project
Page 27: Project