You are on page 1of 3

#include <iostream>

using namespace std;

int main ()

// Variables

char letter;

float grade;

// Enter grades

cout << "Enter your Grade between 60 to 100: ";

cin >> grade;

cout << "---------------------------------------" << endl;

// Grades to letter

cout << "To know the equivalent letter of your grade:" << endl;

cout << "Type 1 if your grade is 96 to 100" << endl;

cout << "Type 2 if your grade is 91 to 95" << endl;

cout << "Type 3 if your grade is 86 to 90" << endl;

cout << "Type 4 if your grade is 81 to 85" << endl;

cout << "Type 5 if your grade is 74.5 to 80" << endl;

cout << "Type 6 if your grade is 71 to 74.5" << endl;

cout << "Type 7 if your grade is 60 to 70: ";

cin >> letter;

cout << "---------------------------------------" << endl;


switch(letter)

case '1':

cout << "Your grade is A+";

break;

case '2':

cout << "Your grade is A-";

break;

case '3':

cout << "Your grade is A";

break;

case '4':

cout << "Your grade is B";

break;

case '5':

cout << "Your grade is C";

break;

case '6':

cout << "Your grade is D";

break;

case '7':

cout << "Your grade is E";

break;
default:

// if the letter is other than 1, 2, 3, 4, 5, 6, or 7 error message is shown

cout << "Error! please type a valid number.";

break;

return 0;

You might also like