You are on page 1of 22

GOVERNMENT POLYTECHNIC, JINTUR.

DEPARTMENT OF COMPUTER ENGINEERING

COURSE & CODE-OOP/22316


ACADEMIC YEAR- 2023-24

A MICRO-PROJECT ON
“Student Report Card Using File Handling in
C++.”
FOR THE AWARD OF

DIPLOMA IN ENGINEERING & TECHNOLOGY

(COMPUTER ENGINEERING-CO 3I)


UNDER THE GUIDANCE OF
Prof.R.D.KOKARE SIR
SUBMITTED BY

ROLL.NO ENROLLMENT NO NAME OF STUDENT


227 2200940102 Surwase kishor babu

232 2200940117 Navghare vivek suresh

238 2200940134 Mane rohan rajeshwar

250 2200940162 Awad Rahul laxman

263 23510240181 Folane Shivraj Asaram

1
GOVERNMENT POLYTECHNIC,JINTUR.
DEPARTMENT OF COMPUTER ENGINEERING

CERTIFICATE
This is to certify that the Micro-project entitled “ Student Report Card Using File Handling In
C++”being submitted here with for the award of DIPLOMA IN ENGINEERING &
TECHNOLOGY in COMPUTER ENGINEERING of MAHARASHTRA STATE BOARD &
TECHNICAL EDUCATION (MSBTE) GOVERNMENT POLYTECNIC,JINTUR is the
result of Micro-project work completed by roll no 27,32,38,50 under the supervision and guidance
of Prof. R.D.KOKARE SIR

It is to the best of my knowledge and belief that the work embodied in this Micro-project has not
formed earlier the basis for the award of any degree or diploma of this or any other Board or
examining body

Place: JINTUR
Date:
V.S.Ekhande Prof. P.B.KALE Dr . PACKORE SIR
(Micro-project Guide) H.O.D Principal

2
DECLARATION

We are undersigned hereby declare that the project entitled “ Student Report Card Using File
Handaling In C++ ” is written and submitted by us to Government Polytechnic jintur during Year

2023-24, first Semester for partial fulfillment of the ‘Micro Project’ requirement of ‘ OOP ’ course
under Maharashtra State Board of Technical Education, Mumbai curriculum, under the guidance of
V.S.Ekhande madam is our original work.

The empirical findings in this project are based on the collected data and are not copied from any
other sources.

ROLL NO ENROLLMENT NO NAME OF STUDENT

227 2200940102 Surwase kishor babu

232 2200940117 Navghare vivek suresh

238 2200940134 Mane rohan rajeshwar

250 2200940162 Awad Rahul laxman

263 23510240181 Folane Shivraj Asaram

3
ACKNOWLEDGEMENTS

We have great pleasure to express my immense gratitude towards a dynamic person and our
project guidance, V.S.Ekhande Department of Computer Engeneering Government Polytechnic,
JINTUR for giving us an opportunity to work on an interesting topic over one semester. The work
presented here could not have been accomplished without her most competent and inspiring
guidance, incessant encouragement, constructive criticism and constant motivation during all phases
of our group Micro-project work. We are highly indebted to her.

We are very much thankful to Prof. KALE SIR, Head Department of Computer
Engeneering, all HODs of various departments and Prof. PACKORE SIR, The Principal of
Government Polytechnic, jintur for his encouragement and providing us a motivating environment
and project facilities in the Institute to carry out experiments and complete this Micro-project work.

We would like to extend my thanks to all our professors, staff members and all our
friends who extended their co-operation to complete the project.

We are indeed indebted to my parents and other family members for their immense
help at all levels with moral, social & financial support, care and support throughout our
studies without which our work would not have seen light of the day.

With warm regards,


Yours Sincerely,

4
GOVERNMENT POLYTECHNIC, JINTUR.
DEPARTMENT OF COMPUTER ENGENEERING

COURSE & CODE-OOP/22316


ACADEMIC YEAR- 2022-23
A MICRO-PROJECT ON

“Student Report Card Using File Handling In c++”


(COMPUTER ENGINEERING-CO 3I)

INDEX

Sr.no Title Page no


1 Introduction 06

2 Class and object 08

3 Introduction of student report card 09

4 Program 10

5 Output 16

6 Conclusion 20

7 Reference 21

5
Introduction
1) Introduction to objects oriented programming:
The major purpose of C++ programming is to introduce the concept of object orientation
to the C programming language. Object Oriented Programming is a paradigm that provides
many concepts such as inheritance, data binding, polymorphism etc. The programming
paradigm where everything is represented as an object is known as truly object-oriented
programming language.

Smalltalk is considered as the first truly object-oriented programming language. Object


means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a
methodology or paradigm to design a program using classes and objects. It simplifies the
software development and maintenance by providing some concepts

2) Advantages of objects oriented programming:

➢ OOPs makes development and maintenance easier where as in Procedure-oriented


programming language it is not easy to manage if code grows as project size grows.

➢ OOPs provide data hiding whereas in Procedure-oriented programming language a global


data can be accessed from anywhere.

➢ OOPs provide ability to simulate real-world event much more effectively. We can provide
the solution of real word problem if we are using the Object-Oriented Programming
language. 3) Importance features of objects oriented programming:

6
a) Object:
Any entity that has state and behavior is known as an object. For example: chair, pen, table,
keyboard, bike etc. It can be physical and logical.
b) Class:
Collection of objects is called class. It is a logical entity. Class is a user defined data type.

c) Inheritance:

When one object acquires all the properties and behavior of parent object known as

inheritance. It provides code reusability. It is used to achieve runtime polymorphism. d)

Polymorphism:

When one task is performed by different ways known as polymorphism. For example:

to convince the customer differently, to draw something shape or rectangle etc. In C++, we use
Function overloading and Function overriding to achieve polymorphism. e) Abstraction:

Hiding internal details and showing functionality is known as abstraction. For example:
phone call, we don't know the internal processing. In C++, we use abstract class and
interface to achieve abstraction.

f) Encapsulation:

Binding (or wrapping) code and data together into a single unit is known as encapsulation.
For example: capsule, it is wrapped with different medicines.

g) File handling
7
File handling in C++ is a mechanism to store the output of a program in a file and help
perform various operations on it. Files help store these data permanently on a storage
device. The term “Data” is commonly referred to as known facts or information.

CLASSES AND OBJECTS

Class: A class in C++ is the building block that leads to Object-Oriented


programming. It is a user-defined data type, which holds its own data members and member
functions, which can be accessed and used by creating an instance of that class. A C++ class
is like a blueprint for an object.

For Example: Consider the Class of Cars. There may be many cars with different
names and brand but all of them will share some common properties like all of them will
have 4 wheels, Speed Limit, Mileage range etc. So here, Car is the class and wheels, speed
limits, mileage are their properties.

A Class is a user defined data-type which has data members and member functions.
Data members are the data variables and member functions are the functions used to
manipulate these variables and together these data members and member functions defines
the properties and behavior of the objects in a Class.

In the above example of class Car, the data member will be speed limit, mileage etc and
member functions can be apply brakes, increase speed etc.

An Object is an instance of a Class. When a class is defined, no memory is allocated but


when it is instantiated (i.e. an object is created) memory is allocated.

8
Introduction of student report card
Student report card system project in C++ is a simple console application built without the
use of graphics. In this project, users can perform typical report card related functions like adding a
new student record and displaying, modifying, editing and deleting it. File handling has been
effectively used to perform all these. This project will teach you how to use file handling in C++,
add, read, display, search, modify and delete record from file.

The source code is complete, totally error-free and around 400 lines. I haven’t included the
source code for copy/paste here as it is a bit long; you can directly download it from the link below.
Also, you can use the description provided here as a general abstract of this project.

1. Create student report card record: This feature creates a new student record containing
his marks. For this the information to be provided are the name and roll no. of the student, and the
marks obtained by him/her in 5 subjects – Physics, Chemistry, Maths, English and Computer
Science.

2. Read all students report card record: The void display_all() function in this student report
card system project in C++ has been used for this feature. It basically shows the progress report of
all the students added in file. This feature displays the roll no. and name of all the students, the
marks obtained by them in 5 subjects – Physics, Chemistry, Maths, English and Computer Science,
along with the percentage and grade of each student

3. Read specific student’s report card record: This feature is same as the one explained
above, except it shows the progress report and relevant data related to a particular student.

4. Display all students’ grade report: This feature enlists all the students’ record saved in file. The
grade report is displayed in a tabular form with roll no. and name of the students, marks achieved in
the five subjects, and the grade and percentage obtained by them.

5. Modify student’s report card record: In student report card system project in C++, this
feature is used to edit the report card record of a particular student. For this, the name and roll no.
of the student is sought. Upon successful modification, the program displays the message “Record
Updated”. If no record of student is found in file, it displays the message “Record not found”.

6. Delete student record: This feature deletes the report card record of a particular student; it
first of all asks for the name and roll no. of the student whose record is to be deleted

9
Program code
#include<conio.h>
#include<stdio.h>
#include<stdlib.h> #include<fstream.h>
#include<iomanip.h>
class student { int
rollno; char name[50];
int oop_marks,dsu_marks,dte_marks,dbms_marks,cgr_marks;
float per; char grade; int std;
void calculate()
{
per=(oop_marks+dsu_marks+dte_marks+dbms_marks+cgr_marks)/5.0;
if(per>=60) grade='A'; else if(per>=50 && per<60) grade='B';
else if(per>=33 && per<50)
grade='C';
else
grade='F';
} public:
void
getdata()
{
cout<<"\nENTER THE ROLL NUMBER OF STUDENT: ";
cin>>rollno;
cout<<"\n\nENTER THE NAME OF STUDENT: ";
gets(name);
cout<<"\nENTER THE MARKS OF C++ ";
cin>>oop_marks;
cout<<"\nENTER THE MARKS OF DSU : ";
cin>>dsu_marks; cout<<"\nEnter THE MARKS
OF DTE : "; cin>>dte_marks;
cout<<"\nENTER THE MARKS OF DBMS :";
cin>>dbms_marks; cout<<"\nENTER THE
MARKS OF CGR :"; cin>>cgr_marks;
calculate();
}

void showdata()
10
{
cout<<"\nRoll number of student : "<<rollno;
cout<<"\nName of student :"<<name; cout<<"\nMarks
in OOP : "<<oop_marks; cout<<"\nMarks in DSU :
"<<dsu_marks; cout<<"\nMarks in DTE : "<<dte_marks;
cout<<"\nMarks in DBMS : "<<dbms_marks;
cout<<"\nMarks in CGR :"<<cgr_marks;
cout<<"\nPERCENTAGE OF STUDENT:"<<setprecision(2)<<per;
cout<<"\nGRADE OF STUDENT :"<<grade;
}

void show_tabular()
{
cout<<rollno<<setw(12)<<name<<" "<<setw(10)<<oop_marks<<" "<<setw(3)<<dsu_marks<<"
"<<setw(3)<<dte_marks<<" "<<setw(3)<<dbms_marks<<" "<<setw(3)<<cgr_marks<<"
"<<setw(3)<<setprecision(4)<<per<<setw(8)<<" "<<grade<<endl;
}

int retrollno()
{
return rollno;
}

}; fstream fp; student


st; void
write_student()
{ fp.open("student.dat",ios::out|ios::app);
st.getdata();
fp.write((char*)&st,sizeof(student));
fp.close();
cout<<"\n\nSTUDENT RECORD HAS BEEN CREATED...";
getch(); }
void display_all()
{ clrscr();
cout<<"\n\n\n\t\t\t***DISPLAY ALL RECORD***\n\n";
fp.open("student.dat",ios::in);
while(fp.read((char*)&st,sizeof(student)))
{
st.showdata();
cout<<"\n\n====================================\n";
getch();
} fp.close();
getch();
}
void display_sp(int n)

11
{ int flag=0;
fp.open("student.dat",ios::in);
while(fp.read((char*)&st,sizeof(student)))
{ if(st.retrollno()==n)
{
clrscr(); st.showdata();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"\n\nRECORD NOT EXITS...."; getch(); }
void update_student()
{ int
no,found=0;
clrscr();
cout<<"\n\n\tTO MODIFY "; cout<<"\n\n\tPLEASE ENTER THE
ROLL NO OF STUDENT :";
cin>>no;
fp.open("student.dat",is::in|ios::out);
while(fp.read((char*)&st,sizeof(student)) && found==0)
{
if(st.retrollno()==no)
{
st.showdata();
cout<<"\nPLEASE ENTER THE NEW DETAILS OF STUDENT :"<<endl;
st.getdata(); int pos=pos-1*sizeof(st); fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(student)); cout<<"\n\n\t RECORD UPDATED...";
found=1;
}
}
fp.close();
if(found==0)
cout<<"\n\n RECORD NOT FOUND..."; getch();
}
void delete_student()
{ int no; clrscr();
cout<<"\n\
n\n\tDELE
T
RECORD.
..";
cout<<"\n\nPLEASE ENTER THE ROLL NUMBER YOU WANT TO DELETE :";
cin>>no;
fp.open("student.dat",ios::in|ios::out);

12
fstream fp2;
fp2.open("Temp.dat",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&st,sizeof(student)))
{
if(st.retrollno()!=no)
{
fp2.write((char*)&st,sizeof(student));
}
} fp2.close(); fp.close(); remove("student.dat");
rename("Temp.dat","student.dat");
cout<<"\n\n\tRECORD DELETED ..";
getch(); }
void class_result()
{ clrscr();
fp.open("student.data",ios::in);
if(!fp)
{
cout<<"ERROR!!! FILE COULD NOT BE OPEN\n\n\n GO TO ENTRY MENU TO CREATE FILE";
cout<<"\n\n\n Program is closing .... ";
getch();
exit(0);
}

cout<<"\n\n\t\t\t****ALL STUDENTS RESULT*** \n\n";

cout<<"=========================================================================\n";
cout<<"Roll No Name OOP DSU DTE DBMS CGR PER GRADE\n";

cout<<"=========================================================================\n";

while(fp.read((char*)&st,sizeof(student)))
{
st.show_tabular();
} fp.close();
getch(); }
void result()
{
int ans,rno;
char ch; clrscr();
cout<<"\n\n\n\t\tRESULT MENU"; cout<<"\n\n\t\t\t1. CLASS RESULT\n\n\t\t\t2. STUDENT REPORT
CARD\n\n\t\t\t3.BACK TO MAIN MENU"; cout<<"\n\n\t\t\tEnter Choice (1/2)? "; cin>>ans; switch(ans)
{
case 1 :
13
class_result();
break; case
2:
{
do
{
clrscr();
char ans;
cout<<"\n\nENTER ROLL NUMBER OF STUDENT : ";
cin>>rno; display_sp(rno);
cout<<"\n\nDO YOU WANT TO SEE MORE RESULT (y/n)?"; cin>>ans;
}
while(ans=='y'||ans=='Y');

break;
} case
3:
break; default:
cout<<"\a";
}}
void intro()
{
clrscr();
cout<<"\n\n\t\t\t*******WELCOME TO STUDENT REPORT CARD*********** ";
cout<<"\n\n\t\t\t******* COMPUTER ENGINEERING ********"; cout<<"\n\n\t\t\t**** NAME OF
STUUDENT ****"; cout<<" \n\t\t\t1.RIYA PUDAT\n\t\t\t2.SACHIN RATHOD\n\t\t\t3.SAKSHI
TIDKE\n\t\t\t4.VISHAL UGALE\n\t\t\t5.LAXMAN KHILLARE"; cout<<"\n\n\t\t\t\t\tGUIDANCE BY
:MRS.A.H.JADHAV"; cout<<"\n\n\t\t\tPRESS ANY KEY TO CONTINUE......."; getch();

}
void entry_menu()
{ clrscr(); char
ch2;
cout<<"\n\n\n\t\t\tENTRY MENU"; cout<<"\n\n\t\t\t1.CREATE
STUDENT RECORD"; cout<<"\n\n\t\t\t2.DISPLAY ALL
STUDENTS RECORDS"; cout<<"\n\n\t\t\t3.SEARCH
STUDENT RECORD "; cout<<"\n\n\t\t\t4.UPDATE STUDENT
RECORD"; cout<<"\n\n\t\t\t5.DELETE STUDENT RECORD";
cout<<"\n\n\t\t\t6.BACK TO MAIN MENU";
ch2=getche();
switch(ch2)
{ case
'1':
clrscr();
write_student();

14
break; case
'2':
display_all();
break; case
'3':
int num;
clrscr();
cout<<"\n\n\tPLEASE ENTER THE ROLL NUMBER :"; cin>>num;
display_sp(num);
break; case '4':
update_student();
break; case
'5':
delete_student();
break; case
'6':
break; default:
cout<<"\nPLEASE SELECT A VALID CHOICE ";
entry_menu();
}
} void
main() {
char ch;
intro(); do
{
clrscr(); cout<<"\n\n\n\t\t\t***MAIN
MENU***"; cout<<"\n\n\t\t\t01. RESULT MENU";
cout<<"\n\n\t\t\t02.
MAIN MENU";
cout<<"\n\n\t\t\t03. EXIT";
ch=getche();
switch(ch)
{
case '1':
clrscr();
result(); break;
case '2': entry_menu();
break; case '3':
exit(0); default :
cout<<"\nPLEASE ENTER THE VALID CHOICE ";
}
}
while(ch!='3');
}

15
Out put

16
17
18
19
20
Conclusion
Programming in C++ is perfect for beginners to code and therefore before proceeding it is essential
to gain a few basic codes of C++ programming.

For creating an ATM machine program using C++, we need to implement the four fundamental
concepts of each ATM system that exists, it includes cash withdraw, cash deposit, account balance
checks, and functionality for another transaction or termination.

21
Reference
1. https://devenum.com/simple-atm-machineprojectsource-
code-in-c/
2. https://economictimes.indiatimes.com/wealth/save/9usef
ul-services-provided-bytheatm/articleshow/54863934.cms

22

You might also like