User defined functions and obtaining prime numbers

I am trying to to calculate and display the number of primes between 1 and 1000 using two user defined functions. I have the code to find a prime, and to count the amount of primes in a list of numbers but I think my mistake may lie somewhere in the function main? I have been working on this for the last seven hours! I don't know how the time has seemed to pass so quickly while I have gotten nowhere.

[code]
Put the code you need help with here.


#include <iostream>
#include <cmath>


using namespace std;

long primeCount(long x, long y);
bool isPrime(long n);

int main()
{
char reply;
int number;
int count = 0;
int x;
int y;
int i;

cout << "Enter two numbers:" << endl;
cin >> x >> y;

cout << primeCount;

cout << "Press q (or any other key) followed by 'Enter' to quit: ";
cin >> reply;


}


long primeCount(long x, long y)
{
int count = 0;
for (int i = x; i <=1; i++)
{
if (isPrime(i))
count++;
}
return count;
}



bool isPrime(long n)
{
int i;

if (n <= 1)
return false;
else if (n == 2)
return true;
else if (n % 2)
return false;
for (i = 3; i < n; i += 2)
{
if (n % i == 0)
return false;
}
return true;
}
http://www.cplusplus.com/forum/general/112111/
foo.cpp: In function ‘int main()’:
foo.cpp:22:10: warning: the address of ‘long int primeCount(long int, long int)’ will always evaluate as ‘true’ [-Waddress]
foo.cpp:13:6: warning: unused variable ‘number’ [-Wunused-variable]
foo.cpp:14:6: warning: unused variable ‘count’ [-Wunused-variable]
foo.cpp:17:6: warning: unused variable ‘i’ [-Wunused-variable]
foo.cpp: At global scope:
foo.cpp:31:6: warning: unused parameter ‘y’ [-Wunused-parameter]


cout << primeCount; is not calling the primeCount() function

primeCount(13,42);
Maybe main is not grabbing the proper info that needs to be used. Could that be it? I am very lost. I don't need to use reference parameters, just value parameters, and I don't believe I need to use void functions either for this assignment. I am having a hard time separating and understanding all three, especially void functions -again of which I don't think I even need. Thank you for the tips so far. I didnt get any warnings when I ran this on visual studio.
Topic archived. No new replies allowed.