dear people i have an assignment due in one hour and its not working.
i have to write a program with four functions that finds out and print the twin prime numbers. i followed every step in the assignment and its not giving any error but i dont have any output so far even in one of my functions i have cout too.
the last function to print the twin prims is not done yet here is my code
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
void makeSieve ( bool sieve[], const int sieveSize );
void workSieve ( bool sieve[], const int sieveSize );
void findBoundaries (int &lower, int &upper, const int sieveSize );
void showTwins (const bool sieve[], const int lower, const int upper );
int main()
{
const int SIZE = 120001;
bool sieve [SIZE];
int low, high;
makeSieve (sieve, SIZE);
workSieve (sieve, SIZE);
findBoundaries (low, high, SIZE );
showTwins (sieve, low, high );
return 0;
}
void makeSieve ( bool sieve[], const int sieveSize )
{
for ( int i=2; i < sieveSize; i++ )
{
sieve[i]= true;
}
sieve[1]=false;
sieve[0]=false;
}
//==============================================================
void workSieve ( bool sieve[], const int sieveSize )
{
for ( int A=2; A<=sqrt(120000); A++)
{
for (int B=3; B <= 120000; B++)
{
if(sieve[B]%2==0)sieve[B]=false;
}
if (sieve[A]%3==0)sieve[A]=false;
}
}
//=============================================================
void findBoundaries (int &lower, int &upper, const int sieveSize )
{
do
{
while(upper>0 && upper<=120000)
{
cout << "Please Enter the upper boundary (between 1 and 120000): " << endl;
cin >> upper;
}
while (lower>0 && lower<=120000)
{
cout << "Please enter the lower boundary (between 1 and 120000): " << endl;
cin >> lower;
}
}while (lower>upper);
return;
}
void showTwins (const bool sieve[], const int lower, const int upper )
{
}