Student Report Card
Student Report Card
C INTER COLLEGE
P.H.E.D BUTY RANCHI
SESSION:-2021-2023
PROJECT ON
COMPUTER SCIENCE
C++
STD:-12th ‘B’
ROLL NO:-054
SUBJECT:- Science
ON
STUDENT REPORT
CARD
MANAGEMENT
SYSTEM
Page 1 of 36
Certificate
Principal
Page 2 of 36
INDEX
3) Introduction 05
4) Source Code 07
5) Output Window 26
6) Conclusion 35
7) Bibliography 36
Page 3 of 36
Acknowledgement
Page 4 of 36
INTRODUCTION
Student report card system project in C++ is a simple console
application built without the use of graphics. This project student
report card system helps in managing the record of students
according to their class roll no. 054 In this project we tried to
enter all details of students like roll no, name, marks in all five
subjects, etc. and tried to maintain all the possibility which
may help the us to enter more record if he/she requires. Some
of the features of the program are:
Page 5 of 36
Header Files Used:
1) #include<iostream>
It is the predefined library function used for input and
output also called as header files. iostream is the header file
which contain sall the functions of program like cout, cin etc.and
#include tells the preprocessor to include these header file in the
program The file iostream is located in
your include path.
2) #include<fstream>
File streams include two member functions specifically
designed to read and write binary data sequentially: write and
read. The first one (write) is a member function of ostream
(inherited by ofstream). And read is a member function of
istream (inherited by ifstream). Objects of class fstream
have both.
3)#include<iomanip>
The header <iomanip> is part of the Input/output library of
the C++ Standard Library. It defines the manipulator functions reset
iosflags(),setiosflags(),setbase(),setfill(), setprecision() , and
setw() . These functions may be conveniently used by C++ programs
to affect the state of iostream objects.
Page 6 of 36
Source code
#include<iostream>
#include<fstream>
#include<iomanip>
class student
introllno;
char name[50];
per;
char grade;
public:
show_tabular() const;
Page 7 of 36
intretrollno() const;
};
void student::calculate()
per=(p_marks+c_marks+m_marks+e_marks+cs_marks)/5.0; if(per>=90)
grade='A';
else if(per>=80&&per<90)
grade='B';
else if(per>=70)
grade='C';
else if(per>=60)
grade='B';
else if(per>=50)
grade='D';
else if(per>=40)
grade='E';
else
grade='F';
Page 8 of 36
}
void student::getdata()
cin>>rollno;
cout<<"\nEnterThemarksinphysicsoutof100:"; cin>>p_marks;
cin>>c_marks;
cin>>m_marks;
cin>>cs_marks;
calculate();
Page 9 of 36
}
:"<<grade;
cout<<rollno<<setw(6)<<" \t "<<name<<"\
t"<<setw(10)<<p_marks<<setw(4)<<c_marks<<setw(4)<< m_marks<<setw(4)
Page 10 of 36
<<e_marks<<setw(4)<<cs_marks<<setw(8)<<per<<setw(6)<<grad e<<endl;
return rollno;
Page 11 of 36
// THE MAIN FUNCTION OF PROGRAM
int main()
ios::showpoint);
do
{
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t03. EXIT";
cout<<"\n\n\tPlease Select Your Option (1-3): ";
Page 12 of 36
cin>>ch;
switch(ch)
{
case '1':result();
break;
break;
case '3':
break;
default :cout<<"\a";
}while(ch!='3');
return 0;
student st;
ofstreamoutFile;
outFile.open("student.dat",ios::binary|ios::app);
Page 13 of 36
st.getdata();
outFile.close();
cin.ignore();
cin.get();
student st;
ifstreaminFile;
inFile.open("student.dat",ios::binary); if(!
inFile)
{
cin.ignore();
cin.get();
return;
Page 14 of 36
cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";
st.showdata();
cout<<"\n\n============================================
=======================\n";
inFile.close();
cin.ignore();
cin.get();
student st;
ifstreaminFile;
inFile.open("student.dat",ios::binary); if(!
inFile)
{
Page 15 of 36
cout<<"File could not be open !! Press any Key...";
cin.ignore();
cin.get();
return;
}
bool flag=false;
if(st.retrollno()==n)
st.showdata();
flag=true;
}
inFile.close();
if(flag==false)
cin.ignore();
cin.get();
Page 16 of 36
// FUNCTION TO MODIFY RECORDS OF FILE
void modify_student(int n)
boolfound=false;
File;
File.open("student.dat",ios::binary|ios::in|ios::out); if(!File)
{
cin.ignore();
cin.get();
return;
}
if(st.retrollno()==n)
Page 17 of 36
{
st.showdata();
st.getdata();
intpos=(-1)*static_cast<int>(sizeof(st));
File.seekp(pos,ios::cur); File.write(reinterpret_cast<char
*> (&st),
sizeof(student));
found=true;
File.close();
if(found==false)
cin.ignore();
cin.get();
Page 18 of 36
// FUNCTION TO DELETE RECORD OF FILE
voiddelete_student(int n)
studentst;
ifstreaminFile;
inFile.open("student.dat",ios::binary); if(!
inFile)
cin.ignore();
cin.get();
return;
}
ofstreamoutFile;
outFile.open("Temp.dat",ios::out);
inFile.seekg(0,ios::beg);
if(st.retrollno()!=n)
Page 19 of 36
outFile.write(reinterpret_cast<char *> (&st),
sizeof(student));
outFile.close();
inFile.close();
remove("student.dat");
rename("Temp.dat","student.dat");
cin.ignore();
//cin.get();
studentst;
ifstreaminFile;
inFile.open("student.dat",ios::binary); if(!
inFile)
{
Page 20 of 36
cout<<"File could not be open !! Press any Key...";
cin.ignore();
cin.get();
return;
}
cout<<"===============================================
====================\n";
cout<<"===============================================
====================\n";
while(inFile.read(reinterpret_cast<char *> (&st), sizeof(student)))
st.show_tabular();
cin.ignore();
//cin.get();
inFile.close();
}
void result()
Page 21 of 36
{
charch;
intrno;
Choice(1/2/3)?"; cin>>ch;
switch(ch)
break;
case '2' : class_result();
cout<<"===============================================
====================\n";
Page 22 of 36
display_sp(rno);
break;
default: cout<<"\a";
}
charch; intnum;
Page 23 of 36
cin>>ch;
switch(ch)
{
case'1': write_student();
break;
case'2': display_all();
break;
case'3': class_result();
cout<<"===============================================
====================\n";
display_sp(num);
break;
case'4': class_result();
cout<<"===============================================
====================\n";
Page 24 of 36
break;
case'5': class_result();
cout<<"===============================================
====================\n";
delete_student(num);
break;
case'6': break;
Page 25 of 36
OUTPUT WINDOWS
OF THE
ABOVE PROGRAM
Page 26 of 36
RESULT MENU
Page 27 of 36
SELECTING THE OPTION STUDENTREPORT
CARD(2.)
Page 28 of 36
IF YOUPRESS 3 THENTHEPROGRAMSWILL
RETURN TO MAIN MENU
From The Main Menu Again
Page 29 of 36
SELECTING THE CREATE OPTION
Page 30 of 36
SELECTING THE DIPSPLAY OPTION
Page 31 of 36
SELECTING THE SEARCH OPTION
Page 32 of 36
SELECTING THE MODIFY OPTION
Page 33 of 36
SELECTING THE DELETE OPTION
Page 34 of 36
CONCLUSION
This software has its advantages and disadvantages but it
can surely help with the record storage system. We don't
have to worry about them is placing of record which
is a great clash while storing the record on separate
files.
Limitations
Page 35 of 36
Bibliography
http://www.wikipedia.com
Thank
you
Page 36 of 36