Kahoot inspired trivia game based on C++ Qt framework
Random numbers are generated through the srand function in game.cpp
srand(time(NULL));
The current time is used as a seeds and manipulated through an algorithm to ensure "real" random numbers
The range of the random number can be set as such in main.cpp
int generate_random(int min, int max)
{
return rand()%(max + 1 - min) + min;
}
Through the srand function, the program
- Generate two random numbers
- Randomly selects an operation (and caculates the answer)
- Generate three simliar numbers based on the answer
- Randomly selects a button for the correct answers and the other threes for the wrong answers
And thats the basis of the game!
git clone https://github.com/henryqingmo/Simple-Trivia.git
cd Simple-Trivia
chmod +x Simple-Trivia
./Simple-Trivia
Known issues of the game is here