#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

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

    while (true) {
        int a = rand() % 10 + 1;
        int b = rand() % 10 + 1;

        char operation;

        if (rand() % 2 == 0) {
            operation = '+';
        } else {
            operation = '-';
        }

        // Make sure subtraction does not give a negative answer
        if (operation == '-' && a < b) {
            swap(a, b);
        }

        int correctAnswer;

        if (operation == '+') {
            correctAnswer = a + b;
        } else {
            correctAnswer = a - b;
        }

        int answer;

        cout << a << " " << operation << " " << b << " = ";
        cin >> answer;

        if (answer == correctAnswer) {
            cout << "Correct! Great job! 😊" << endl;
            cout << endl;
        } else {
            cout << "Wrong answer! Game Over. ❌" << endl;
            cout << "The correct answer was: " << correctAnswer << endl;
            break;
        }
    }

    return 0;
}