๐ŸŽฎ Math Speed Drill & Even-Odd Identifier Challenge

๐ŸŽฎ Project 1: Math Speed Drill


๐Ÿ“ Project Overview

Property Details
Project Name Math Speed Drill Game
Language C++
Difficulty Level Beginner
Main Concepts Loops, Random Numbers, Time Calculation
Game Type Timed Challenge
Target User Students improving mental math speed

๐ŸŽฏ Objective

To challenge users with simple math problems (addition/subtraction) and measure how quickly they answer 5 of them.


๐Ÿ“„ Features

  • 5 random math questions.

  • Measures total time taken to answer.

  • Reports time and score at the end.

  • Encourages fast, accurate thinking.


๐Ÿ”ง Tools Required

  • C++ compiler

  • Timer support via <chrono>

  • IDE (Code::Blocks / VS Code) or terminal


๐Ÿ’ป Source Code

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

using namespace std;
using namespace std::chrono;

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

    cout << "๐Ÿง  Welcome to Math Speed Drill!\n";
    cout << "You will be given 5 simple addition or subtraction problems.\n";
    cout << "Try to answer them as fast and correctly as you can!\n\n";

    auto start = high_resolution_clock::now(); // Start timer

    for (int i = 1; i <= 5; ++i) {
        int a = rand() % 50 + 1;
        int b = rand() % 50 + 1;
        int operation = rand() % 2; // 0 for +, 1 for -
        int answer, user;

        if (operation == 0) {
            answer = a + b;
            cout << "Q" << i << ": " << a << " + " << b << " = ";
        } else {
            answer = a - b;
            cout << "Q" << i << ": " << a << " - " << b << " = ";
        }

        cin >> user;

        if (user == answer) {
            cout << "✅ Correct!\n";
            correct++;
        } else {
            cout << "❌ Wrong. Correct answer is: " << answer << "\n";
        }
    }

    auto stop = high_resolution_clock::now(); // Stop timer
    auto duration = duration_cast<seconds>(stop - start);

    cout << "\n⏱️ Total Time: " << duration.count() << " seconds\n";
    cout << "๐Ÿ Final Score: " << correct << "/5\n";

    return 0;
}

๐Ÿง  Learning Concepts

  • chrono for measuring time.

  • Use of randomization and conditionals.

  • Beginner-level problem-solving practice.


๐ŸŽฏ Sample Output

๐Ÿง  Welcome to Math Speed Drill!
Q1: 14 + 27 = 41
✅ Correct!
Q2: 35 - 19 = 16
✅ Correct!
...
⏱️ Total Time: 21 seconds
๐Ÿ Final Score: 4/5


๐ŸŽฎ Project 2: Even-Odd Identifier Challenge


๐Ÿ“ Project Overview

Property Details
Project Name Even-Odd Identifier Game
Language C++
Difficulty Level Beginner
Main Concepts Loops, Modulo Operator, Scorekeeping
Game Type Classification (Math logic)
Target User Kids learning even and odd numbers

๐ŸŽฏ Objective

This game tests how quickly and accurately a user can identify whether a number is even or odd. Great for early learners or warm-up logic drills.


๐Ÿ“„ Features

  • 10 random numbers shown.

  • User must type "even" or "odd".

  • Game checks answers and gives final score.

  • Simple, intuitive logic-building.


๐Ÿ’ป Source Code

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <algorithm>

using namespace std;

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

    cout << "๐Ÿ”ข Welcome to the Even-Odd Identifier Game!\n";
    cout << "You will be shown 10 random numbers.\n";
    cout << "Type 'even' or 'odd' based on the number shown.\n\n";

    for (int i = 1; i <= 10; ++i) {
        int number = rand() % 100 + 1;
        string answer;

        cout << "Q" << i << ": " << number << " is (even/odd)? ";
        cin >> answer;

        // Convert input to lowercase
        transform(answer.begin(), answer.end(), answer.begin(), ::tolower);

        bool isEven = number % 2 == 0;

        if ((isEven && answer == "even") || (!isEven && answer == "odd")) {
            cout << "✅ Correct!\n";
            score++;
        } else {
            cout << "❌ Wrong. It is actually " << (isEven ? "even" : "odd") << ".\n";
        }
    }

    cout << "\n๐Ÿ Game Over. You got " << score << " out of 10 correct.\n";

    return 0;
}

๐Ÿง  Learning Concepts

  • Using modulo (%) to check even/odd.

  • string manipulation (transform to lowercase).

  • Simple conditional logic.


✅ Sample Output

Q1: 33 is (even/odd)? odd
✅ Correct!
Q2: 70 is (even/odd)? odd
❌ Wrong. It is actually even.
...
๐Ÿ Game Over. You got 8 out of 10 correct.

๐Ÿง  Takeaways for Beginners

  • Practice with simple logic-based conditions.

  • Intro to string, transform, and modulo.

  • Builds fast decision-making for math skills.


๐Ÿ“ฆ Compilation Instructions

To compile and run either game:

g++ speed_drill.cpp -o speed
./speed

g++ even_odd_game.cpp -o evenodd
./evenodd