i made this code to find if a positive integer n is prime or not. But it doesnt work (we i run it, it doesnt return anything). I have a similar code for python and that works fine but this one in c++ it doesnt, i dont know why.
#include <iostream>
bool isPrime(int num, int count=0, int div =1) {
if (div>num){
if (count==2){
return true;
}else{
return false;
}
}else{
if (num % div ==0){
count ++;
}
return isPrime(num, count, div++);
}
}
int main(){
int n;
std::cin >> n;
std::cout << isPrime(n);
return 0;
}