I have the following code
int i, a, z; i = 2343243443; a = 5464354324324324; z = i * a; cout << z << endl;
When these are
ints only hold 32 bits. When the result of a multiplication is larger than 2^31 - 1, the result rolls over to a large negative value. Instead of using the int data type, use long long int, which holds 64 bits.