Code:

#include<iostream>
#include<conio.h>
using std::cout;
using std::cin;
using std::endl;
// function prototype
void prime(void);
int main()
{
// display prime numbers
prime();
getch();
}
// definition of prime()
void prime(void)
{
// declare alias
int num;
for( num=1; num<=1000; num+=2 )
{
cout<< num<<endl;
}
}

With the above code i meant to view all the prime numbers from 1 - 1000. It gives the right output , thats okeys. The only thing I don't understand is the parse error it gives when i do the following changes to the above code,

instead of prime();

i write the following

cout<< prime();

or

cout<<prime(void);

in both of the above cases it gives a parse error before token')'. I dont understand this. Last but not the least when i only change prime(); to prime(void); with no cout<< at the beginning it gives me all the prime numbers from 403 - 999 but not from 1-999 y is this so? Can anyone explain this logic.