• GPA Management System in C++: A Smart Way to Track Your Academic Performance


    GPA Management System in C++: A Smart Way to Track Your Academic Performance

    Maintaining a good GPA is crucial for academic success, and having an efficient system to calculate and manage it can be a game-changer. Today, I present a C++ GPA Management System that helps students calculate their GPA, CGPA, and guided study plans based on their goals.

    This program provides various functionalities, including:
    GPA Calculation based on percentage and credit hours
    CGPA Calculation across multiple semesters
    Guided Study Plan to help achieve a desired GPA
    File Management to save and delete GPA records


    Features of the GPA Management System

    📌 1. Calculate GPA for Each Subject

    • The program calculates GPA based on percentage scores and credit hours.
    • It supports multiple subjects and different grading scales (e.g., 4.0, 5.0, or 10.0).

    📌 2. CGPA Calculation

    • The user enters GPA and credit hours for previous semesters, and the system computes CGPA based on weighted scores.

    📌 3. Guided Study Plan for Desired GPA

    • Students can enter their current academic performance and goal GPA, and the system provides a personalized study plan to improve their performance.

    📌 4. File Handling (Save & Delete GPA Records)

    • The system allows users to save GPA records into a file and delete them when necessary.

    C++ Code for GPA Management System

    Here's the complete C++ code for the GPA Management System:


    #include <iostream> #include <vector> #include <iomanip> #include <string> #include <fstream> using namespace std; struct Subject { string name; double gpa; int creditHours; double percentage; int credits; }; vector<Subject> subjects; double get_grade_point(double percentage, double max_gpa) { if (percentage >= 85) { return max_gpa; } else if (percentage >= 70) { return max_gpa * 0.75; } else if (percentage >= 55) { return max_gpa * 0.5; } else if (percentage >= 40) { return max_gpa * 0.25; } else { return 0.0; } } void calculate_gpa() { int num_subjects; double max_gpa; cout << "Enter the maximum GPA scale (e.g., 4.0 or 5.0): "; cin >> max_gpa; cout << "Enter the number of subjects: "; cin >> num_subjects; vector<Subject> subjects(num_subjects); double total_weighted_grade_points = 0; int total_credits = 0; for (int i = 0; i < num_subjects; ++i) { cout << "\nSubject " << (i + 1) << ":" << endl; cout << "Enter your percentage for the subject (0-100): "; cin >> subjects[i].percentage; cout << "Enter the credit hours for the subject: "; cin >> subjects[i].credits; double grade_point = get_grade_point(subjects[i].percentage, max_gpa); total_weighted_grade_points += grade_point * subjects[i].credits; total_credits += subjects[i].credits; } if (total_credits > 0) { double gpa = total_weighted_grade_points / total_credits; cout << "\nYour overall GPA is: " << gpa << endl; } else { cout << "\nNo credits entered. Cannot calculate GPA." << endl; } } void calculateCGPA() { int numSemesters; cout << "Enter the number of semesters completed: "; cin >> numSemesters; if (numSemesters <= 0) { cout << "Invalid number of semesters!" << endl; return; } double totalWeightedPoints = 0.0; int totalCreditHours = 0; for (int i = 1; i <= numSemesters; ++i) { double semesterGPA; int semesterCredits; cout << "Enter GPA for Semester " << i << ": "; cin >> semesterGPA; cout << "Enter total credit hours for Semester " << i << ": "; cin >> semesterCredits; totalWeightedPoints += semesterGPA * semesterCredits; totalCreditHours += semesterCredits; } if (totalCreditHours == 0) { cout << "Total credit hours cannot be zero!" << endl; } else { double cgpa = totalWeightedPoints / totalCreditHours; cout << "\nYour CGPA is: " << fixed << setprecision(2) << cgpa << endl; } } void guideForDesiredGPA() { double currentWeightedScore, desiredGPA, gpaScale; int nextSemesterCredits, dailyStudyHours; cout << "\nEnter your current weighted score (percentage): "; cin >> currentWeightedScore; cout << "Enter your dream GPA: "; cin >> desiredGPA; cout << "Enter the GPA scale (e.g., 4 for a 4.0 scale or 10 for a 10.0 scale): "; cin >> gpaScale; cout << "Enter total credit hours for the next semester: "; cin >> nextSemesterCredits; cout << "How many hours do you study daily? "; cin >> dailyStudyHours; double requiredWeightedScore = (desiredGPA / gpaScale) * 100.0; if (requiredWeightedScore <= currentWeightedScore) { cout << "\nCongratulations! You are already on track to achieve your dream GPA of " << desiredGPA << " or higher!" << endl; } else { double remainingScore = requiredWeightedScore - currentWeightedScore; cout << "\nTo achieve your dream GPA of " << desiredGPA << ", you need to improve your total weighted score by " << remainingScore << "%." << endl; cout << "Focus on improving performance in assignments, quizzes, and exams to bridge the gap.\n"; } } void saveData(const vector<Subject>& subjects) { ofstream outFile("gpa_data.txt"); if (!outFile) { cerr << "Error opening file for saving data!" << endl; return; } outFile << "Number of Subjects: " << subjects.size() << endl; for (const auto& subject : subjects) { outFile << "Subject: " << subject.name << ", GPA: " << subject.gpa << ", Credit Hours: " << subject.creditHours << endl; } outFile.close(); cout << "Data saved successfully!" << endl; } void deleteData() { if (remove("gpa_data.txt") != 0) { cerr << "Error deleting file!" << endl; } else { cout << "Data deleted successfully!" << endl; } } int main() { int choice; while (true) { cout << "\n--- GPA Management System ---\n"; cout << "1. Calculate GPA\n"; cout << "2. Calculate CGPA\n"; cout << "3. Guide for desired GPA\n"; cout << "4. Save Data\n"; cout << "5. Delete Data\n"; cout << "6. Exit\n"; cout << "Enter your choice: "; cin >> choice; switch (choice) { case 1: calculate_gpa(); break; case 2: calculateCGPA(); break; case 3: guideForDesiredGPA(); break; case 4: saveData(subjects); break; case 5: deleteData(); break; case 6: cout << "Exiting the program. Goodbye!" << endl; return 0; default: cout << "Invalid choice! Please select a valid option." << endl; } } }

    Conclusion

    This GPA Management System is a great tool for students to track and plan their academic progress. With GPA and CGPA calculations, study plan recommendations, and file-saving capabilities, it helps students stay on top of their academic goals.

    💡 Try this program and make GPA tracking easier! 🚀

  • 0 Comments:

    Post a Comment

    GET A FREE QUOTE NOW

    Have questions about fees or need personalized assistance? Feel free to visit my LinkedIn profile for more details and inquiries!

    Powered by Blogger.
    ADDRESS

    CB-1279, Street no 8, Chour Chowk, Rawalpindi, Pakistan

    EMAIL

    adnanxn34101@gmail.com

    MOBILE PHONE

    +92346-802913-8
    +92317-052974-0