Counting Prime numbers within a range.

Hey I'm having trouble with a problem from school. I need to write a program that counts the number of prime numbers between a certain range. I must create and use a helper function that checks prime numbers. I must also use the function header bool isPrime(int). I know I need to make a for-loop in both the main function and the bool function. There also does not have to be user input, as you can just set the range. This is what I have so far...

#include <iostream>

using namespace std;

bool isPrime(int num) //Bool function
{
for(int lower=1,higher=10; lower<higher; lower++) //To check if prime
{
if (lower%higher <= 0)
return false;

}

return true;
}

int main()
{

int lower=1; //Lower Limit
int higher=10; //Upper Limit
int num; // Number of Prime Numbers


I dont know how to set up my main function. Any help is appreciative!
Topic archived. No new replies allowed.