The problem with my code arises when I try putting in a value for quadmin and quadmax of around 60000. It starts saying all the results are negative numbers, though they can't be because of the numbers I'm using.

Code:

short a;
short bc;
short cc;
unsigned short iterations;
cout << " " << endl;
cout << " " << endl;
cout << "----------------------------------------------" << endl;
cout << " " << endl;
cout << " " << endl;
cout << "How many quadratics? (from n=min to n=max)" << endl;
cout << "min?" << endl;
cin >> quadmin;
cout << "max?" << endl;
cin >> quadmax;
cout << "How many iterations? (from 0 to 65,535)" << endl;
cin >> iterations;
cout << "a?" << endl;
cin >> a;
cout << "b c?" << endl;
cin >> bc;
cout << "c c?" << endl;
cin >> cc;
cout << " " << endl;
cout << " " << endl;
cout << "-----------------------------------------" << endl;
cout << " " << endl;
cout << " " << endl;
for(n = quadmin; n <= quadmax; n++)
{
//keeps track of how many primes result for this quadratic
int primes = 0;
//keeps track of the total iterations for this quadratic
int total = 0;
//START of test for increasing values of i
for(unsigned short i=0;i<iterations;i++)
{
short flag = 0;
__int64 num = ((a*i*i) + (((2*a*n)+bc)*i) + ((a*n*n)+(bc*n)+cc));
if(num>1)
{
if((num%2)==0) //checks against 2
{
flag = 1;
}
else
{
// checks odds from 3 up to sqrt(n)
for(long m = 3;m<=((long)(sqrt(num)));m+=2)
{
if((num%m)==0)
{
flag = 1;
break;
}
}
}
if(flag==0)
{
primes = primes + 1;
}
total++;
}
else
{
long double r = num;
cout << r << " was tossed out for being <= 1" << endl;
cout << " " << endl;
}
}
cout << a << "x^2 + " << ((2*a*n)+bc) << "x + " << ((a*n*n)+(bc*n)+cc) << endl;
cout << primes << " out of " << total << " were prime." << endl;
cout << " " << endl;
}

and here's the output (including the numbers I used)

Code:

--------------------------------------------
How many quadratics? (from n=min to n=max)
min?
60000
max?
70000
How many iterations? (from 0 to 65,535)
81
a?
1
b c?
-1
c c?
41
-----------------------------------------
-6.95027e+008 was tossed out for being <= 1
-6.94907e+008 was tossed out for being <= 1
-6.94787e+008 was tossed out for being <= 1
-6.94667e+008 was tossed out for being <= 1
-6.94547e+008 was tossed out for being <= 1
-6.94427e+008 was tossed out for being <= 1
-6.94307e+008 was tossed out for being <= 1
-6.94187e+008 was tossed out for being <= 1
-6.94067e+008 was tossed out for being <= 1
-6.93947e+008 was tossed out for being <= 1