This is assigning J the value of numToCheck - 1, and then converting "numToCheck - 1" into a boolean value, which evaluates to true unless numToCheck is 1 (because 1-1 is 0).
#include <iostream>
usingnamespace std;
bool checkPrime(int num);
int main() {
cout << "Prints prime numbers between 3 and maxValue.\n";
cout << "Enter a value into maxValue: ";
int N;
cin >> N;
for (int i = 3; i <= N; i += 2)
if (checkPrime(i))
cout << i << ' ';
cout << '\n';
}
bool checkPrime(int num) {
for (int i = 3; i * i <= num; i += 2)
if (num % i == 0)
returnfalse;
returntrue;
}