Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement