answersLogoWhite

0

Use the following function. Adjust the percentage marks to suit the grades in your university or region. The following applies in most Nova Scotia universities:

std::string get_grade(unsigned mark)

{

if (mark>=90) return "A+";

if (mark>=85) return "A";

if (mark>=80) return "A-";

if (mark>=77) return "B+";

if (mark>=73) return "B";

if (mark>=70) return "B-";

if (mark>=65) return "C+";

if (mark>=60) return "C";

if (mark>=55) return "C-";

if (mark>=50) return "D";

return("E");

}

Example usage:

unsigned mark = 62; // out of 100

std::cout << "A mark of " << mark << "equates to grade " << get_grade(mark);

Output:

A mark of 62 equates to grade C

User Avatar

Wiki User

11y ago

What else can I help you with?