Smaller data types like short int, char which take less number of bytes gets promoted to int or unsigned int as per C++ standard. But not the larger sized data types. This is called Integer promotions.
You can explicitly cast it to a larger type before performing the multiplication(or any arithmetic operation) to avoid this over flow like this:
#include <iostream>
int main()
{
int ax = 1000000000;
int bx = 2000000000;
long long cx = static_cast<long long>(ax) * bx;
std::cout << cx << "\n";
return 0;
}
It will ensure the correct output as 2000000000000000000.