#include #include #include using namespace std; int smallFactor(int x) { int answer = 2; while (x % answer != 0) answer++; return answer; } int main() { int score = 0; srand(time(NULL)); cout << "Are these numbers prime? Y or N: " << endl; for (int c = 1; c <= 10; c++) { int qn = 2; while (smallFactor(qn) < 7) { // reject easy questions qn = rand() % 400 + 2; } cout << qn << "? "; string ans; cin >> ans; if (ans == "Y" && smallFactor(qn) == qn) score ++; if (ans == "N" && smallFactor(qn) < qn) score ++; } cout << endl << "You scored " << score << " out of 10 " << endl; return 0; }