Problem with large values

So i'm trying to divide large numbers into prime factors. My problem is that if the value is greater than 1*10^9 the program does nothing and just exit. Anyone know as to why this happens?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
long int Search = 1 ,a = 2,MaxPrime,prime, PrimeFactor;
int main()
{
	cout << "enter a number that you want divided into prim factors" << endl;
	cin >> MaxPrime;
	PrimeFactor = MaxPrime;

    while (a < PrimeFactor+1)
    {
        for (a; Search < a-1; Search++)
        {
            if (a % Search == 0 && Search != 1)
            {
                Search = 1;
                break;
            }
        }
		  
  
        if (a % Search != 0 || a == 2)
        {
            prime = a;
            Search = 1;
		
	if(PrimeFactor % prime == 0 && prime != 0)
		{
			cout << prime << " is a primefactor in " << PrimeFactor << endl;
			PrimeFactor = PrimeFactor / prime;
			a = 1;
		}
        }
        a++;
    }
	system("pause");

    return 0;
}
A 32-bit signed integer can hold values from -2147483648 to +2147483647.
Sounds like you are exceeding the permitted range.
Topic archived. No new replies allowed.