That wasn't the original goal of this thread but I do want to speed up my program. I am not using the fastest method (sieve.) Here is the main loop of the program.

double pretime = clock ();

//////////////////////////////////////////////////////////////////////////////

/////////////Finds Prime Numbers and outputs while finding them///////////////

//////////////////////////////////////////////////////////////////////////////

int numberofprimes = 0;

for (int number = startnum; number < endnum; number++) {

bool isprime = 0;

// 0 is prime, 1 is not prime. Assumed prime until proven not prime

for (int factor = 2; factor < number / 2 + 1; factor++) {

if (number % factor == 0) {

isprime = 1;

break;//exits loop after number is found to have one integer factor

}//end if

}//end for (int fac...

if (isprime == 0){

numberofprimes++;

if (output_type == 0) {

cout << setw (10) << number;

if (numberofprimes % 5 == 0)

cout << endl;

}

else {//output_type == 1

outs << setw (10) << number;

if (numberofprimes % 10 == 0)

outs << endl;

}

}//end if

}//end for (int nu...

double posttime = clock ();

double timeelapsed = (posttime - pretime) / CLK_TCK;

If you would like to run the program you can download it at

http://robbiem01.tripod.com/primehunter.html