Title
Develop Student Grading System. Accept student data and marks for 5
students. Calculate thepercentage and
subjects forfinalize grade awarded to the
student. Write the records in to file.
Presented By
SRUSHTI KIRAN GADKARI
Prathmesh Pradipkumar Phalle
PRANITA NAMDEV KAMBLE
PRACHITI SHAM CHAVAN
SEJAL NARAYAN SAWANT
Under Guidance of:
MS.Varsha B.Asawale
INDEX
1.Introduction
2.Code
3.Output
4.Explanation
5.Conclusion
INTRODUCTION
Importance of Grading System
• The Student Grading System is a C++ program that helps
calculate grades for students automatically.
• It takes the names and marks of 5 students across 5 subjects,
calculates their percentage, and assigns a grade based on the
result.
• The program makes it easier to manage student records by
calculating the percentage and grade for each student and
saving the details in a text file for future use.
• This system saves time and reduces errors compared to manual
grading.
• Accepts student names and subject marksCalculates percentages
automaticallyAssigns grades based on a grading scaleSaves
student data to a file for future reference
CODE
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
#include<conio.h>
class Student {
private:
char name[20];
int marks[5];
float percentage;
char grade;
public:
void inputData() {
cout << "Enter name of the student: ";
cin >> name;
cout << "Enter marks for 5 subjects: ";
for (int i = 0; i < 5; ++i) {
cin >> marks[i];
}
calculatePercentageAndGrade();
}
void calculatePercentageAndGrade() {
int total = 0;
for (int i = 0; i < 5; ++i) {
total += marks[i];
}
percentage = (float)(total) / 5;
grade = calculateGrade();
}
char calculateGrade() const {
if (percentage >= 90)
return 'A';
else if (percentage >= 75)
return 'B';
else if (percentage >= 60)
return 'C';
else if (percentage >= 50)
return 'D';
else
return 'F';
}
void writeRecord(ofstream &outfile) const {
outfile << setw(20) << name<< setw(20)<< setprecision(2)<<percentage
<<"\t"<< grade << endl;
}
};
int main()
{
int main()
{
const int numStudents = 5;
Student students[numStudents];
int i;
clrscr();
for ( i = 0; i < numStudents; ++i) {
cout << "Entering data for student " << (i + 1) << endl;
students[i].inputData();
}
ofstream outfile("students.txt");
if (!outfile) {
cerr << "Error opening file for writing!" << endl;
return 1;
}
outfile<< setw(20) << "Name"<< setw(20) << "Percentage"<<"\t"<< "Grade"
<< endl;
for ( i = 0; i < numStudents; ++i) {
students[i].writeRecord(outfile);
}
outfile.close();
cout << "Records written to students_grades.txt" << endl;
getch();
return 0;
} .
OUTPUT
EXPLANATION
Grade Calculation Logic
The calculation part of the grading system involves
determining final grades based on various assessments.
We will explore different methods such as average and
grade scaling. Understanding these calculations is key to
accurate grading.
File Output Techniquies
Outputting grades to a file is essential for record-
keeping. We will cover techniques for writing data to text
files in C++. This includes using file streams and
ensuring that the data is formatted correctly for easy
reading and analysis.
CONCLUSION
In conclusion, designing a student grading system
in C++ involves careful attention to data
management, calculation, and file output.
Future enhancements could include adding
features like user interfaces or online access to
grades, making the system more efficient.
THANKS
!