Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<ctime>
- using namespace std;
- int main() {
- int a, b;
- srand(time(0));
- while (1) {
- a = rand() % 16;
- b = rand() % 16;
- while (1) {
- int c;
- cout << hex << uppercase << a << " + " << b << " = ";
- cin >> hex >> c;
- if (c == a + b) {
- cout << "Yes!" << endl;
- break;
- }
- else if (c != a + b) {
- cout << "No!" << endl;
- continue;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement