#include <iostream>
using namespace std;
int main()
{
int intVar =1500000000;
intVar = (intVar *10)/10;
cout << "Value intVar equal "<<intVar <<endl;
intVar =1500000000;
intVar = (static_cast<double>(intVar)*10)/10;
cout << "Value intVar equal " <<intVar<<endl;
return 0;
}
In this example, the first answer must be incorrect (211509811) due limit of variable type int, but it isn`t. What is wrong?
cout << std::numeric_limits<int>::max()?