UK grade converter

*Update* 9th June 2021… I have made a UI to this and will be uploading it in a few days

So here is the issue, schools in the UK changed the way they grade children so instead of grades A to whatever it’s a numerical value now so I have made a converter for both businesses and students to understand their grades more. Here is the engine behind it I will be changing it to the “Switch Case” system soon but for now “if” statements work just as well. A UI and downloadable version will be coming soon!

#include <iostream>

void gradesInput();

void returnMessage()
{
    std::cout << "Please enter another numerical value" << std::endl;
    gradesInput();
}

void gradesInput()
{
    int numberInput;
    std::cin >> numberInput;
    
    if(numberInput == 9 || numberInput == 8)
    {
        printf("The alphabetical grade is: A*\n");
        returnMessage();
    }
    
    if(numberInput == 7)
    {
        printf("The alphabetical grade is: A\n");
        returnMessage();
    }
    
    if(numberInput == 6 || numberInput == 5)
    {
        printf("The alphabetical grade is: B\n");
        returnMessage();
    }
    
    if(numberInput == 4)
    {
        printf("The alphabetical grade is: C\n");
        returnMessage();
    }
    
    if(numberInput == 3)
    {
        printf("The alphabetical grade is: D\n");
        returnMessage();
    }
    
    if(numberInput == 2)
    {
        printf("The alphabetical grade is: E / F\n");
        returnMessage();
    }
    
    if(numberInput == 1)
    {
        printf("The alphabetical grade is: G\n");
        returnMessage();
    }
}

int main()
{
    std::cout << "Welcome to the grade number to letter converter" << std::endl;
    printf("Enter the grade in numerical value: ");
    gradesInput();
}

Related Post

Leave a Reply

Your email address will not be published.