For example I wasn't sure whether to use an array or vectors for keeping track of invalid_attempts and incorrect_attempts.

The program is basically to generate nCr (combinations formula) questions, ask user for answer and verify the answer.

The program currently keeps track of invalid attempts and incorrect attempts but it would support time spent to answer a question as well, in the future.

You can specify ranges for question, n and r.

Additional questions:
Is it possible to declare an array with a variable as index declared value?
eg:
Code:
int a = 10;
int b[a];
here b must be allotted 10 spaces.

I take it that you cannot increase the size of an array after it has been declared.

Also what can I use to manipulate the text on the console window and the console window itself? Is there anything like graphics.h in modern c++17 compilers (I use microsoft visual 2017) or would I have to use a library?

If so what library must I use? I know GUI would be the way to go but console programming is so much simpler and I just write programs for myself that help me practice my math and etc.

Otherwise what's a good GUI library?
code:
Code:
#include <iostream>
#include <ctime>
#include <Windows.h>
#include <vector>

int random(int n, int m) {
    return rand() % (m - n + 1) + n;
}

unsigned long long int factorial(unsigned int input) {
    unsigned long long int factorial = 1;
    for (unsigned int i = 1; i <= input; ++i) 
        factorial *= i;
    return factorial;
}

int main() {
    srand(time(NULL));

    bool validator = false;
    unsigned int inputted_n;
    unsigned int inputted_r;
    unsigned int no_of_questions;

    validator = true;
    while (validator) {
        system("cls");
        std::cout << "How many questions would you like to answer?: ";
        std::cin >> no_of_questions;
        if (!std::cin) {
            std::cin.clear();
            std::cin.ignore();
        }
        else if (no_of_questions == 0) {
            std::cout << "Great, you're done answering 0 questions! What now?";
            Sleep(1000);
            std::cin.get();
        }
        else
            validator = false;
    }

    validator = true;
    while (validator) {
        system("cls");
        std::cout << "Range for n: ";
        std::cin >> inputted_n;
        if (!std::cin) {
            std::cin.clear();
            std::cin.ignore();
        }
        else if(inputted_n>19) {
            std::cout << "n does not support value greater than 19 currently.. due to loss of precision";
            Sleep(1000);
            std::cin.get();
        }
        else
            validator = false;
    }

    validator = true;
    while (validator) {
        system("cls");
        std::cout << "Range for n: " << inputted_n;
        std::cout << "\nRange for r: ";
        std::cin >> inputted_r;
        if (!std::cin) {
            std::cin.clear();
            std::cin.ignore();
        }
        else if (inputted_r > inputted_n) {
            std::cout << "r cannot be greated than n!";
            Sleep(1000);
            std::cin.get();
        }
        else
            validator = false;
    }

    bool run_time = true;
    unsigned int iteration = 0;
    unsigned int answer, taken_answer, no_of_regular_questions = 0, no_of_easy_questions = 0, is_correct = 0;
    std::vector <int> invalid_attempts, incorrect_attempts;

    while (run_time) {

        iteration++;
        if (iteration > no_of_questions) {
            run_time = false;
            break;
        }

        invalid_attempts.push_back(0);
        incorrect_attempts.push_back(0);

        int n = random(1, inputted_n);
        int r = random(0, inputted_r);

        while (r > n)
            r = random(0, inputted_r);

        answer = (factorial(n)) / (factorial(r)*factorial(n - r));

        validator = true;
        while (validator) {
            system("cls");
            std::cout << iteration << ") Find nCr if n = " << n << ", r = " << r << "\nAnswer(";
            if (is_correct == 1)
                std::cout << "CORRECT";
            else if (is_correct == 2)
                std::cout << "INCORRECT";
            else if (is_correct == 3)
                std::cout << "INVALID";
            std::cout<<"): ";
            std::cin >> taken_answer;
            if (!std::cin) {
                std::cin.clear();
                std::cin.ignore();
                is_correct = 3;
                invalid_attempts[iteration-1]++;
            }
            else if (taken_answer == answer) {
                validator = false;
                is_correct = 1;
            }
            else {
                is_correct = 2;
                incorrect_attempts[iteration-1]++;
            }
        }

        if (r == 0 || r == 1 || r == n)
            no_of_easy_questions++;
        else
            no_of_regular_questions++;
    }
    
    system("cls");
    std::cout << "You've answered " << no_of_questions << " question";
        if (no_of_questions > 1)
            std::cout << "s";
    std::cout<<". Of which " << no_of_easy_questions << " of them"; 
    if (no_of_easy_questions == 1)
        std::cout << "is";
    else
        std::cout << "are";
    std::cout<<" considered as \"easy\"";

    std::cout << "\n\nPerformance Summary:\n\n";
    for (unsigned int i = 0; i < no_of_questions; i++) {
        std::cout << "Question (<" << i << ">):  Failed Attempts = (";
        if (incorrect_attempts[i] == 0)
            std::cout << "ZER0!";
        else
            std::cout << incorrect_attempts[i];
        std::cout << "),  Invalid Attempts = (";
        if (invalid_attempts[i] == 0)
            std::cout << "ZER0";
        else
            std::cout << invalid_attempts[i];
        std::cout << "),  \n\tQuestion was answered in NOT IMPLEMENTED seconds\n\n";
    }

    std::cin.get();
    std::cin.get();
    std::cin.get();

    return 0;
}