The code checks to see if n is prime by checking if n is less than 2 and also testing for primes by dividing n by each of the integers 2, 3, 5, 7, and 11.
bool isPrime(int n) {
if(n < 2) return false;
for(int i = 2; i <= sqrt(n); i++) {
if(n % i == 0) return false;
}
return true;
}