#include <iostream>
#include <random>
using namespace std;
int main()
{
//seed random gen
random_device seed{};
// random gen
mt19937 engine{ seed() };
//uniform distribution
uniform_int_distribution<> dis{1,10};
//generate 2 random ints
int a{ dis(engine) };
int b{ dis(engine) };
//output
cout << a << " * " << b << " = ? ";
int userAnswer{};
cin >> userAnswer;
if (userAnswer == (a*b))
{
cout << "Correct!\n";
}
else
{
cout << "Wrong!\n";
}
}
Comments