DEV Community

Cover image for CGPA CALCULATOR
suryansh taragi
suryansh taragi

Posted on

CGPA CALCULATOR

Description of the Code:

The provided C++ code converts a Cumulative Grade Point Average (CGPA) to its equivalent percentage. Here's a breakdown of the code:

Function cgpaToPercentage:

Takes a double parameter cgpa representing the Cumulative Grade Point Average.
Assumes a simple conversion formula (e.g., CGPA * 10) to calculate the equivalent percentage.
Returns the calculated percentage.

Main Function:

Declares a double variable cgpa to store the user-input CGPA.

Prompts the user to enter their CGPA.

Checks if the entered CGPA is within the valid range (0 to 10).

If valid, calls the cgpaToPercentage function to convert CGPA to percentage.
Prints the equivalent percentage.
Uses cout for output and cin for input.
If the entered CGPA is not within the valid range, prints an error message indicating an invalid CGPA.

Input Validation:

Ensures the entered CGPA is between 0 and 10.

Output:

Displays either the equivalent percentage or an error message based on the validity of the entered CGPA.

Assumption:

The code assumes a linear conversion from CGPA to percentage (CGPA * 10).
It provides a straightforward illustration of converting CGPA to a more commonly used percentage scale.

Note:

The code does not include advanced error handling or additional validation beyond the specified CGPA range.
This code offers a simple utility for students or users to quickly convert their CGPA to a percentage, assuming a direct linear relationship between the two grading systems.

github link-click here

Top comments (2)

Collapse
 
tool_site_ef010e6e2c0167e profile image
Tool Site

ouruniversitypedia
is a dedicated platform offering comprehensive solutions for all your CGPA and GPA calculation needs. Whether you're a student trying to convert your grades into percentages, understand different university grading systems, or simply want to track your academic performance more effectively, the site provides accurate calculators and insightful resources. It's designed to simplify the complex academic evaluation process and help students make informed decisions about their education and career planning.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.